diff --git a/.gitignore b/.gitignore index 45daa288a..f3cbe8ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ tmp.txt ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString/ ca.uhn.fhir.jpa.entity.ResourceTable/ ca.uhn.fhir.jpa.entity.TermConcept/ +.java-version # Vagrant stuff. .vagrant diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/ExtensionDefinitionGenerator.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/ExtensionDefinitionGenerator.java index a029324c0..7b4d717e3 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/ExtensionDefinitionGenerator.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/ExtensionDefinitionGenerator.java @@ -413,7 +413,7 @@ public class ExtensionDefinitionGenerator { return new org.hl7.fhir.dstu2016may.formats.JsonParser().composeBytes(res); } else if (v == FHIRVersion._1_0_2) { VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor(); - org.hl7.fhir.dstu2.model.Resource res = new VersionConvertor_10_40(advisor ).convertResource(resource); + org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_40.convertResource(resource, advisor); return new org.hl7.fhir.dstu2.formats.JsonParser().composeBytes(res); } else if (v == FHIRVersion._4_0_0) { return new JsonParser().composeBytes(resource); @@ -431,7 +431,7 @@ public class ExtensionDefinitionGenerator { } else if (v == FHIRVersion._1_0_2) { org.hl7.fhir.dstu2.model.Resource res = new org.hl7.fhir.dstu2.formats.JsonParser().parse(inputStream); VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor(); - return new VersionConvertor_10_40(advisor ).convertResource(res); + return VersionConvertor_10_40.convertResource(res, advisor); } else if (v == FHIRVersion._4_0_0) { return new JsonParser().parse(inputStream); } else diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGPackConverter102.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGPackConverter102.java index eace03c15..655f45e3b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGPackConverter102.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGPackConverter102.java @@ -53,7 +53,7 @@ public class IGPackConverter102 implements VersionConvertorAdvisor30 { System.out.println("process "+s); org.hl7.fhir.dstu2.formats.XmlParser xp = new org.hl7.fhir.dstu2.formats.XmlParser(); org.hl7.fhir.dstu2.model.Resource r10 = xp.parse(new FileInputStream("C:\\temp\\igpack2\\"+s)); - org.hl7.fhir.dstu3.model.Resource r17 = new VersionConvertor_10_30(this).convertResource(r10); + org.hl7.fhir.dstu3.model.Resource r17 = VersionConvertor_10_30.convertResource(r10, this); org.hl7.fhir.dstu3.formats.XmlParser xc = new org.hl7.fhir.dstu3.formats.XmlParser(); xc.setOutputStyle(OutputStyle.PRETTY); xc.compose(new FileOutputStream("C:\\temp\\igpack2\\"+s), r17); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR3Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR3Loader.java index 1c0230e44..4e4d98764 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR3Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR3Loader.java @@ -55,7 +55,7 @@ public class R2ToR3Loader implements IContextResourceLoader, VersionConvertorAdv r2 = new JsonParser().parse(stream); else r2 = new XmlParser().parse(stream); - org.hl7.fhir.dstu3.model.Resource r3 = new VersionConvertor_10_30(this).convertResource(r2); + org.hl7.fhir.dstu3.model.Resource r3 = VersionConvertor_10_30.convertResource(r2, this); Bundle b; if (r3 instanceof Bundle) b = (Bundle) r3; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR4Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR4Loader.java index bb7c3b483..6169b1424 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR4Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR4Loader.java @@ -55,7 +55,7 @@ public class R2ToR4Loader implements IContextResourceLoader, VersionConvertorAdv r2 = new JsonParser().parse(stream); else r2 = new XmlParser().parse(stream); - org.hl7.fhir.r4.model.Resource r4 = new VersionConvertor_10_40(this).convertResource(r2); + org.hl7.fhir.r4.model.Resource r4 = VersionConvertor_10_40.convertResource(r2, this); Bundle b; if (r4 instanceof Bundle) b = (Bundle) r4; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java index 73ee55ec0..d94b50788 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java @@ -60,7 +60,7 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader, r2 = new JsonParser().parse(stream); else r2 = new XmlParser().parse(stream); - org.hl7.fhir.r5.model.Resource r5 = new VersionConvertor_10_50(this).convertResource(r2); + org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_10_50.convertResource(r2, this); Bundle b; if (r5 instanceof Bundle) b = (Bundle) r5; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java index 5a0e23cc2..8b6b39789 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java @@ -36,16 +36,14 @@ import org.hl7.fhir.r5.terminologies.TerminologyClient; public class TerminologyClientR2 implements TerminologyClient { private FHIRToolingClient client; // todo: use the R2 client - private VersionConvertor_10_50 conv; - + public TerminologyClientR2(String address) throws URISyntaxException { client = new FHIRToolingClient(address); - conv = new VersionConvertor_10_50(null); } @Override public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException { - return (TerminologyCapabilities) conv.convertTerminologyCapabilities(client.getTerminologyCapabilities()); + return VersionConvertor_10_50.convertTerminologyCapabilities(client.getTerminologyCapabilities()); } @Override @@ -55,24 +53,24 @@ public class TerminologyClientR2 implements TerminologyClient { @Override public ValueSet expandValueset(ValueSet vs, Parameters p, Map params) throws FHIRException { - org.hl7.fhir.dstu2.model.ValueSet vs2 = (org.hl7.fhir.dstu2.model.ValueSet) conv.convertResource(vs); - org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) conv.convertResource(p); + org.hl7.fhir.dstu2.model.ValueSet vs2 = (org.hl7.fhir.dstu2.model.ValueSet) VersionConvertor_10_50.convertResource(vs); + org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertor_10_50.convertResource(p); vs2 = client.expandValueset(vs2, p2, params); - return (ValueSet) conv.convertResource(vs2); + return (ValueSet) VersionConvertor_10_50.convertResource(vs2); } @Override public Parameters validateCS(Parameters pin) throws FHIRException { - org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) conv.convertResource(pin); + org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertor_10_50.convertResource(pin); p2 = client.operateType(org.hl7.fhir.dstu2.model.ValueSet.class, "validate-code", p2); - return (Parameters) conv.convertResource(p2); + return (Parameters) VersionConvertor_10_50.convertResource(p2); } @Override public Parameters validateVS(Parameters pin) throws FHIRException { - org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) conv.convertResource(pin); + org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertor_10_50.convertResource(pin); p2 = client.operateType(org.hl7.fhir.dstu2.model.ValueSet.class, "validate-code", p2); - return (Parameters) conv.convertResource(p2); + return (Parameters) VersionConvertor_10_50.convertResource(p2); } @Override @@ -87,11 +85,11 @@ public class TerminologyClientR2 implements TerminologyClient { @Override public CapabilityStatement getCapabilitiesStatementQuick() throws FHIRException { - return (CapabilityStatement) conv.convertResource(client.getConformanceStatementQuick()); + return (CapabilityStatement) VersionConvertor_10_50.convertResource(client.getConformanceStatementQuick()); } @Override public Parameters lookupCode(Map params) throws FHIRException { - return (Parameters) conv.convertResource(client.lookupCode(params)); + return (Parameters) VersionConvertor_10_50.convertResource(client.lookupCode(params)); } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java index 36fe8c318..3f48e515d 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java @@ -179,12 +179,12 @@ public class VersionConversionService { case DSTU2016May: throw new FHIRException("Conversion from DSTU2 to 2016May version is not supported"); case R4: if (useJava && VersionConvertor_10_40.convertsResource(src.fhirType())) - return saveResource40(new VersionConvertor_10_40(null).convertResource(src), dstFormat, style); // todo: handle code system? + return saveResource40(VersionConvertor_10_40.convertResource(src), dstFormat, style); // todo: handle code system? else throw new FHIRException("Conversion from R4 to 2016May version is not supported for resources of type "+src.fhirType()); case STU3: if (useJava && VersionConvertor_10_30.convertsResource(src.fhirType())) - return saveResource30(new VersionConvertor_10_30(null).convertResource(src), dstFormat, style); // todo: handle code system? + return saveResource30(VersionConvertor_10_30.convertResource(src), dstFormat, style); // todo: handle code system? else throw new FHIRException("todo: use script based conversion...."); default: throw new FHIRException("FHIR Version 'unknown' is not supported by the inter-version convertor"); @@ -215,7 +215,7 @@ public class VersionConversionService { case DSTU1: throw new FHIRException("FHIR Version #1 is not supported by the inter-version convertor"); case DSTU2: if (useJava && VersionConvertor_10_30.convertsResource(src.fhirType())) - return saveResource10(new VersionConvertor_10_30(null).convertResource(src), dstFormat, style); // todo: handle code system? + return saveResource10(VersionConvertor_10_30.convertResource(src), dstFormat, style); // todo: handle code system? else throw new FHIRException("todo: use script based conversion...."); case DSTU2016May: @@ -238,7 +238,7 @@ public class VersionConversionService { case DSTU1: throw new FHIRException("FHIR Version #1 is not supported by the inter-version convertor"); case DSTU2: if (useJava && VersionConvertor_10_40.convertsResource(src.fhirType())) - return saveResource10(new VersionConvertor_10_40(null).convertResource(src), dstFormat, style); // todo: handle code system? + return saveResource10(VersionConvertor_10_40.convertResource(src), dstFormat, style); // todo: handle code system? else throw new FHIRException("Conversion from R4 to DSTU2 version is not supported for resources of type "+src.fhirType()); case DSTU2016May: diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java index 2892f6c65..5f07a78e1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java @@ -20,33 +20,24 @@ package org.hl7.fhir.convertors; * #L% */ - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.codec.binary.Base64; +import org.hl7.fhir.convertors.conv10_30.*; import org.hl7.fhir.dstu2.model.CodeableConcept; import org.hl7.fhir.dstu2.utils.ToolingExtensions; import org.hl7.fhir.dstu3.conformance.ProfileUtilities; -import org.hl7.fhir.dstu3.model.*; -import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction; -import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; -import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType; -import org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent; -import org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority; -import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.dstu3.model.Enumeration; import org.hl7.fhir.dstu3.model.Timing.EventTiming; import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.Utilities; +import java.util.ArrayList; +import java.util.List; + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,13151 +66,2641 @@ import org.hl7.fhir.utilities.Utilities; POSSIBILITY OF SUCH DAMAGE. */ - -// Generated on Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 - - public class VersionConvertor_10_30 { - public VersionConvertorAdvisor30 advisor; - - public VersionConvertor_10_30(VersionConvertorAdvisor30 advisor) { - super(); - this.advisor = advisor; - } - - public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - - - public org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - case URL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceName(src.getName()); - tgt.setId(src.getName()); - } - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasNameReference()) - tgt.setContentReference("#"+src.getNameReference()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - else - tgt.setName(src.getId()); - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - tgt.setShort(src.getShort()); - tgt.setDefinition(src.getDefinition()); - tgt.setComments(src.getComment()); - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setNameReference(src.getContentReference().substring(1)); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - tgt.setMustSupport(src.getMustSupport()); - tgt.setIsModifier(src.getIsModifier()); - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); - for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) - if (src.hasTarget()) - tgt.setTargetProfile(t.getValueAsString()); - else - tgt.setProfile(t.getValue()); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) - copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertUriToCode(src.getCodeElement())); - if (src.hasTarget()) { - if (src.hasTargetProfile()) - tgt.addProfile(src.getTargetProfile()); - } else if (src.hasProfile()) - tgt.addProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) - copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); - tgt.addWhen(convertEventTiming(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeType) - return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateType) - return convertDate((org.hl7.fhir.dstu2.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IdType) - return convertId((org.hl7.fhir.dstu2.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2.model.OidType) - return convertOid((org.hl7.fhir.dstu2.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.StringType) - return convertString((org.hl7.fhir.dstu2.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2.model.TimeType) - return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UriType) - return convertUri((org.hl7.fhir.dstu2.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.Extension) - return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2.model.Coding) - return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2.model.Period) - return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2.model.Range) - return convertRange((org.hl7.fhir.dstu2.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2.model.Reference) - return convertReference((org.hl7.fhir.dstu2.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2.model.Signature) - return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2.model.Address) - return convertAddress((org.hl7.fhir.dstu2.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu2.model.ElementDefinition) src, new ArrayList()); - if (src instanceof org.hl7.fhir.dstu2.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2.model.Meta) - return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2.model.Timing) - return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu2.model.Age) - return convertAge((org.hl7.fhir.dstu2.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2.model.Count) - return convertCount((org.hl7.fhir.dstu2.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2.model.Distance) - return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Duration) - return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2.model.Money) - return convertMoney((org.hl7.fhir.dstu2.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.dstu3.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(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(convertExtension(t)); - for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(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(convertExtension(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - - public org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - tgt.setImplicitRules(src.getImplicitRules()); - tgt.setLanguage(src.getLanguage()); - } - public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.dstu2.model.Account src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setStatus(convertAccountStatus(src.getStatus())); - tgt.setActive(convertPeriod(src.getActivePeriod())); - tgt.setBalance(convertMoney(src.getBalance())); -// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOwner(convertReference(src.getOwner())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Account convertAccount(org.hl7.fhir.dstu3.model.Account src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Account tgt = new org.hl7.fhir.dstu2.model.Account(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setName(src.getName()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setStatus(convertAccountStatus(src.getStatus())); - tgt.setActivePeriod(convertPeriod(src.getActive())); - tgt.setBalance(convertMoney(src.getBalance())); -// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOwner(convertReference(src.getOwner())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu2.model.Account.AccountStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu3.model.Account.AccountStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Account.AccountStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu2.model.Account.AccountStatus.INACTIVE; - default: return org.hl7.fhir.dstu2.model.Account.AccountStatus.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - private org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case INPROCESS: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - private org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasEvent()) { - tgt.setType(convertCoding(src.getEvent().getType())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) - tgt.addSubtype(convertCoding(t)); - tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); - tgt.setRecorded(src.getEvent().getDateTime()); - tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); - tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) - tgt.addPurposeOfEvent().addCoding(convertCoding(t)); - } - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); - copyDomainResource(src, tgt); - tgt.getEvent().setType(convertCoding(src.getType())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) - tgt.getEvent().addSubtype(convertCoding(t)); - tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); - tgt.getEvent().setDateTime(src.getRecorded()); - tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); - tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) - for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) - tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addParticipant(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addObject(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setUserId(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) - tgt.addPurposeOfUse().addCoding(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setUserId(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) - for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) - tgt.addPurposeOfUse(convertCoding(cc)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; - case _2: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; - case _3: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; - case _5: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (advisor.ignoreEntry(src)) - return null; - - org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - org.hl7.fhir.dstu2.model.Resource res = advisor.convert(src.getResource()); - if (res == null) - res = convertResource(src.getResource()); - tgt.setResource(res); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case DRAFT: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; - } - } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu2.model.ClinicalImpression src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setAssessor(convertReference(src.getAssessor())); - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); - tgt.addProtocol(src.getProtocol()); - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - if (src.hasPrognosis()) - tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getPlan()) -// tgt.addPlan(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAction()) - tgt.addAction(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ClinicalImpression tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setAssessor(convertReference(src.getAssessor())); - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); - for (UriType t : src.getProtocol()) - tgt.setProtocol(t.asStringValue()); - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getPlan()) -// tgt.addPlan(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) - tgt.addAction(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; - case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } - } - -// public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - tgt.setItem(convertCodeableConcept(src.getItem())); -// tgt.setCause(src.getCause()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - try { - tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - } -// tgt.setCause(src.getCause()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; - case REJECTED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; - case FAILED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; - default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; - case ABORTED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CommunicationRequest tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.getRequester().setAgent(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setOccurrence(convertType(src.getScheduled())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setAuthoredOn(src.getRequestedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { - for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ASAP; - } - return null; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu3.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester().getAgent())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setScheduled(convertType(src.getOccurrence())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setRequestedOn(src.getAuthoredOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority priority) { - org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; - case PLANNED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case REQUESTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case REJECTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; -// case FAILED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; -// case PLANNED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - try { - tgt.setConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - tgt.setConfidentiality(src.getConfidentiality().toCode()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getMode()) - copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getMode()) - copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - try { - tgt.setMode(org.hl7.fhir.dstu3.model.Composition.SectionMode.fromCode(src.getMode())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - tgt.setMode(src.getMode().toCode()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; - - } - - public org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - public org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - - private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); - } - return res; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getSource()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getTarget()); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComments(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getCodeSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setCodeSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasDateRecorded()) - tgt.setAssertedDate(src.getDateRecorded()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - try { - tgt.setClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.fromCode(src.getClinicalStatus())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasAssertedDate()) - tgt.setDateRecorded(src.getAssertedDate()); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.setCategory(convertCodeableConcept(t)); - tgt.setClinicalStatus(src.getClinicalStatus().toCode()); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVISIONAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; - case DIFFERENTIAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - case CONFIRMED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; - case REFUTED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVISIONAL: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; - case DIFFERENTIAL: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - case CONFIRMED: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; - case REFUTED: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - tgt.addCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getCode()) - tgt.setCode(convertCodeableConcept(cc)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) - tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - boolean batch = false; - boolean transaction = false; - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { - if (t.getCode().equals(SystemRestfulInteraction.BATCH)) - batch = true; - else - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) - transaction = true; - } - if (batch) - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); - else - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.dstu2.model.Contract src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSubject()) - tgt.addSubject(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthority()) - tgt.addAuthority(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDomain()) - tgt.addDomain(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSubType()) - tgt.addSubType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Contract.ActorComponent t : src.getActor()) - tgt.addAgent(convertAgentComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.SignatoryComponent t : src.getSigner()) - tgt.addSigner(convertSignatoryComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertValuedItemComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getTerm()) - tgt.addTerm(convertTermComponent(t)); - tgt.setBinding(convertType(src.getBinding())); - for (org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) - tgt.addFriendly(convertFriendlyLanguageComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent t : src.getLegal()) - tgt.addLegal(convertLegalLanguageComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent t : src.getRule()) - tgt.addRule(convertComputableLanguageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract tgt = new org.hl7.fhir.dstu2.model.Contract(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) - tgt.addSubject(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) - tgt.addAuthority(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) - tgt.addDomain(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) - tgt.addSubType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contract.AgentComponent t : src.getAgent()) - tgt.addActor(convertAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) - tgt.addSigner(convertSignatoryComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertValuedItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) - tgt.addTerm(convertTermComponent(t)); - tgt.setBinding(convertType(src.getBinding())); - for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) - tgt.addFriendly(convertFriendlyLanguageComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) - tgt.addLegal(convertLegalLanguageComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) - tgt.addRule(convertComputableLanguageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu2.model.Contract.ActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.ActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu2.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - if (src.hasSignature()) - tgt.addSignature(new org.hl7.fhir.dstu3.model.Signature().setBlob(src.getSignature().getBytes())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu2.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.setSignature(Base64.encodeBase64String(t.getBlob())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu2.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Contract.TermActorComponent t : src.getActor()) - tgt.addAgent(convertTermAgentComponent(t)); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertTermValuedItemComponent(t)); - for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) - tgt.addActor(convertTermAgentComponent(t)); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertTermValuedItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.dstu2.model.Contract.TermActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.TermActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DataElement tgt = new org.hl7.fhir.dstu2.model.DataElement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.dstu2.model.Device src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setUdi((new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); - tgt.setStatus(convertDeviceStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setManufacturer(src.getManufacturer()); - tgt.setManufactureDate(src.getManufactureDate()); - tgt.setExpirationDate(src.getExpiry()); - tgt.setModel(src.getModel()); - tgt.setVersion(src.getVersion()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setOwner(convertReference(src.getOwner())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Device tgt = new org.hl7.fhir.dstu2.model.Device(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasUdi()) - tgt.setUdi(src.getUdi().getDeviceIdentifier()); - tgt.setStatus(convertDeviceStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setManufacturer(src.getManufacturer()); - tgt.setManufactureDate(src.getManufactureDate()); - tgt.setExpiry(src.getExpirationDate()); - tgt.setModel(src.getModel()); - tgt.setVersion(src.getVersion()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setOwner(convertReference(src.getOwner())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; - case NOTAVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; - case INACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setLastSystemChange(src.getLastSystemChange()); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus()) - tgt.addOperationalStatus(convertCodeableConcept(t)); - tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); - for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) - tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); - tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setLastSystemChange(src.getLastSystemChange()); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) - tgt.addOperationalStatus(convertCodeableConcept(t)); - tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); - for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) - tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); - tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); - copyElement(src, tgt); - tgt.setSpecType(convertCodeableConcept(src.getSpecType())); - tgt.setComponentId(convertIdentifier(src.getComponentId())); - tgt.setProductionSpec(src.getProductionSpec()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); - copyElement(src, tgt); - tgt.setSpecType(convertCodeableConcept(src.getSpecType())); - tgt.setComponentId(convertIdentifier(src.getComponentId())); - tgt.setProductionSpec(src.getProductionSpec()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - if (src.hasBodySiteCodeableConcept()) - tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); - tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) - tgt.addIndication(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) - tgt.addNote().setText(t.getValue()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - tgt.setBodySite(convertType(src.getBodySite())); - tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) - tgt.addIndication(convertCodeableConcept(t)); - for (Annotation t : src.getNote()) - tgt.addNotes(t.getText()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; -// default: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; -// default: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; -// } -// } - - - public org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu2.model.DocumentManifest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCreated(src.getCreated()); - tgt.setSource(src.getSource()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) - tgt.addContent(convertDocumentManifestContentComponent(t)); - for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentManifestRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentManifest tgt = new org.hl7.fhir.dstu2.model.DocumentManifest(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCreated(src.getCreated()); - tgt.setSource(src.getSource()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) - tgt.addContent(convertDocumentManifestContentComponent(t)); - for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentManifestRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); - copyElement(src, tgt); - tgt.setP(convertType(src.getP())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent(); - copyElement(src, tgt); - tgt.setP(convertType(src.getP())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getCreated()); - tgt.setIndexed(src.getIndexed()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) - return ReferredDocumentStatus.PRELIMINARY; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) - return ReferredDocumentStatus.FINAL; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) - return ReferredDocumentStatus.AMENDED; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) - return ReferredDocumentStatus.ENTEREDINERROR; - - return null; - } - - private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { - CodeableConcept cc = new CodeableConcept (); - switch (docStatus) { - case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; - case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; - case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; - case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getCreated()); - tgt.setIndexed(src.getIndexed()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) - tgt.setFormat(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - tgt.addFormat(convertCoding(src.getFormat())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; - case ARRIVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; - case FINISHED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("IMP"); - case OUTPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); - case AMBULATORY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); - case EMERGENCY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("EMER"); - case HOME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("HH"); - case FIELD: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("FLD"); - case DAYTIME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("SS"); - case VIRTUAL: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("VR"); - default: return null; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src.getSystem().equals("http://hl7.org/fhir/v3/ActCode")) { - if (src.getCode().equals("IMP")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; - if (src.getCode().equals("AMB")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; - if (src.getCode().equals("EMER")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; - if (src.getCode().equals("HH")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; - if (src.getCode().equals("FLD")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; - if (src.getCode().equals("")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; - if (src.getCode().equals("VR")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; - } - return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; - } - -// public org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu3.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); - tgt.setProvider(convertReference(src.getProvider())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu3.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); -// tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); -// tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu3.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setRequest(convertReference(src.getRequest())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setRequestProvider(convertReference(src.getRequestProvider())); - tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu3.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// tgt.setRequest(convertReference(src.getRequestReference())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); -// tgt.setOrganization(convertReference(src.getOrganizationReference())); -// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { -// if (t.hasType()) -// tgt.addServiceType(convertCodeableConcept(t.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(tj)); - } - tgt.addLocation(convertReference(src.getLocation())); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibility())); - tgt.setEligibilityNote(src.getEligibilityNote()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) - tgt.addProgramName(t.getValue()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) -// tgt.addServiceType().setType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) { - if (!tgt.hasServiceType()) - tgt.addServiceType(); - tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.setLocation(convertReference(t)); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibility())); - tgt.setEligibilityNote(src.getEligibilityNote()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) - tgt.addProgramName(t.getValue()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu2.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu3.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) -// tgt.addFrame(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) -// tgt.addFrames(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.UnsignedIntType t : src.getFrameNumbers()) -// tgt.addNumber(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.UnsignedIntType t : src.getNumber()) -// tgt.addFrameNumbers(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// - public org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu2.model.ImagingStudy src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); - copyDomainResource(src, tgt); - tgt.setUid(src.getUid()); - tgt.setAccession(convertIdentifier(src.getAccession())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getModalityList()) - tgt.addModalityList(convertCoding(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setStarted(src.getStarted()); - tgt.setReferrer(convertReference(src.getReferrer())); - tgt.addInterpreter(convertReference(src.getInterpreter())); - tgt.setNumberOfSeries(src.getNumberOfSeries()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProcedure()) - tgt.addProcedureReference(convertReference(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) - tgt.addSeries(convertImagingStudySeriesComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImagingStudy tgt = new org.hl7.fhir.dstu2.model.ImagingStudy(); - copyDomainResource(src, tgt); - tgt.setUid(src.getUid()); - tgt.setAccession(convertIdentifier(src.getAccession())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) - tgt.addModalityList(convertCoding(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setStarted(src.getStarted()); - tgt.setReferrer(convertReference(src.getReferrer())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) - tgt.setInterpreter(convertReference(t)); - tgt.setNumberOfSeries(src.getNumberOfSeries()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProcedureReference()) - tgt.addProcedure(convertReference(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) - tgt.addSeries(convertImagingStudySeriesComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ONLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ONLINE: return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setModality(convertCoding(src.getModality())); - tgt.setDescription(src.getDescription()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - tgt.setBodySite(convertCoding(src.getBodySite())); - tgt.setLaterality(convertCoding(src.getLaterality())); - tgt.setStarted(src.getStarted()); - for (org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setModality(convertCoding(src.getModality())); - tgt.setDescription(src.getDescription()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - tgt.setBodySite(convertCoding(src.getBodySite())); - tgt.setLaterality(convertCoding(src.getLaterality())); - tgt.setStarted(src.getStarted()); - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setSopClass(src.getSopClass()); - tgt.setTitle(src.getTitle()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setSopClass(src.getSopClass()); - tgt.setTitle(src.getTitle()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.dstu2.model.Immunization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - try { - tgt.setStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.fromCode(src.getStatus())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setNotGiven(src.getWasNotGiven()); - tgt.setPrimarySource(!src.getReported()); - if (src.hasPerformer()) - tgt.addPractitioner().setActor(convertReference(src.getPerformer())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("AP"))); - if (src.hasRequester()) - tgt.addPractitioner().setActor(convertReference(src.getRequester())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("OP"))); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setManufacturer(convertReference(src.getManufacturer())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setExpirationDate(src.getExpirationDate()); - tgt.setSite(convertCodeableConcept(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); - for (org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) - tgt.addReaction(convertImmunizationReactionComponent(t)); - for (org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) - tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Immunization tgt = new org.hl7.fhir.dstu2.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(src.getStatus().toCode()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setWasNotGiven(src.getNotGiven()); - tgt.setReported(!src.getPrimarySource()); - tgt.setPerformer(convertReference(getPerformer(src.getPractitioner()))); - tgt.setRequester(convertReference(getRequester(src.getPractitioner()))); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setManufacturer(convertReference(src.getManufacturer())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setExpirationDate(src.getExpirationDate()); - tgt.setSite(convertCodeableConcept(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) - tgt.addReaction(convertImmunizationReactionComponent(t)); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) - tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); - return tgt; - } - - private org.hl7.fhir.dstu3.model.Reference getPerformer(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) - return p.getActor(); - } - return null; - } - - private org.hl7.fhir.dstu3.model.Reference getRequester(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) - return p.getActor(); - } - return null; - } - - private boolean hasConcept(org.hl7.fhir.dstu3.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.dstu3.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotGiven()) - tgt.addReasonNotGiven(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) - tgt.addReasonNotGiven(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDetail(convertReference(src.getDetail())); - tgt.setReported(src.getReported()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDetail(convertReference(src.getDetail())); - tgt.setReported(src.getReported()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu2.model.ImmunizationRecommendation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) - tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu3.model.ImmunizationRecommendation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) - tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setDoseNumber(src.getDoseNumber()); - tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); - for (org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) - tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); - tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingImmunization()) - tgt.addSupportingImmunization(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingPatientInformation()) - tgt.addSupportingPatientInformation(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setDoseNumber(src.getDoseNumber()); - tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); - for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) - tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); - tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingImmunization()) - tgt.addSupportingImmunization(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingPatientInformation()) - tgt.addSupportingPatientInformation(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu2.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getPurpose() == org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.getExample()) - tgt.setPurpose(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); - else - tgt.setPurpose(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.PROFILE); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setTitle(src.getName()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setName(src.getTitle()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.dstu2.model.Media src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertDigitalMediaType(src.getType())); - tgt.setSubtype(convertCodeableConcept(src.getSubtype())); - tgt.setView(convertCodeableConcept(src.getView())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOperator(convertReference(src.getOperator())); - tgt.getDevice().setDisplay(src.getDeviceName()); - tgt.setHeight(src.getHeight()); - tgt.setWidth(src.getWidth()); - tgt.setFrames(src.getFrames()); - tgt.setDuration(src.getDuration()); - tgt.setContent(convertAttachment(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Media tgt = new org.hl7.fhir.dstu2.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertDigitalMediaType(src.getType())); - tgt.setSubtype(convertCodeableConcept(src.getSubtype())); - tgt.setView(convertCodeableConcept(src.getView())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOperator(convertReference(src.getOperator())); - tgt.setDeviceName(src.getDevice().getDisplay()); - tgt.setHeight(src.getHeight()); - tgt.setWidth(src.getWidth()); - tgt.setFrames(src.getFrames()); - tgt.setDuration(src.getDuration()); - tgt.setContent(convertAttachment(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.dstu2.model.Medication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); - copyDomainResource(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setIsBrand(src.getIsBrand()); - tgt.setManufacturer(convertReference(src.getManufacturer())); -// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); - tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Medication tgt = new org.hl7.fhir.dstu2.model.Medication(); - copyDomainResource(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setIsBrand(src.getIsBrand()); - tgt.setManufacturer(convertReference(src.getManufacturer())); -// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); - tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - tgt.setItem(convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - if (src.hasItemReference()) - tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder tgt = new org.hl7.fhir.dstu3.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReasonCodeableConcept()) -// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); -// if (src.hasReasonReference()) -// tgt.addReasonReference(convertReference(src.getReasonReference())); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// if (src.hasNote()) -// tgt.addNote().setText(src.getNote()); -// for (org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu3.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder tgt = new org.hl7.fhir.dstu2.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) -// tgt.setReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) -// tgt.setReason(convertReference(t)); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.setNote(t.getText()); -// for (org.hl7.fhir.dstu3.model.DosageInstruction t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) - tgt.addDerivedFrom(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setReceiver(convertReference(src.getReceiver())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setReceiver(convertReference(src.getReceiver())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) - tgt.addData(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComment(src.getComments()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory()) - tgt.setCategory(convertCodeableConcept(c)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComments(src.getComment()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - tgt.setType(convertCodeableConcept(src.getMeaning())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getMeaning()) - tgt.setMeaning(convertCodeableConcept(src.getType())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setComment(src.getNotes()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setNotes(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { - tgt.setType("string"); - tgt.setSearchType(SearchParamType.fromCode(src.getType())); - } else { - tgt.setType(src.getType()); - } - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSearchType()) { - tgt.setType(src.getSearchType().toCode()); - } else - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.addType(convertCodeableConcept(src.getType())); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - tgt.setAnimal(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) - tgt.addGeneralPractitioner(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - tgt.setAnimal(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) - tgt.addCareProvider(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACE: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; - case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REPLACES: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REFER: return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - if (src.hasName()) - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) -// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.setName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent t : src.getRole()) -// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setOrganization(convertReference(src.getManagingOrganization())); -// tgt.setCode(convertCodeableConcept(src.getRole())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setManagingOrganization(convertReference(src.getOrganization())); -// tgt.setRole(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.dstu2.model.Procedure src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertProcedureStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setNotDone(src.getNotPerformed()); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotPerformed()) - if (src.hasReasonNotPerformed()) - tgt.setNotDoneReason(convertCodeableConcept(src.getReasonNotPerformed().get(0))); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasReasonCodeableConcept()) - tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); - for (org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertProcedurePerformerComponent(t)); - tgt.setPerformed(convertType(src.getPerformed())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReport()) - tgt.addReport(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getComplication()) - tgt.addComplication(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getFollowUp()) - tgt.addFollowUp(convertCodeableConcept(t)); - tgt.addBasedOn(convertReference(src.getRequest())); -// for (org.hl7.fhir.dstu2.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - for (org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Procedure tgt = new org.hl7.fhir.dstu2.model.Procedure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertProcedureStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setNotPerformed(src.getNotDone()); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotPerformed()) - tgt.addReasonNotPerformed(convertCodeableConcept(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - tgt.setReason(convertType(src.getReasonCodeFirstRep())); - for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertProcedurePerformerComponent(t)); - tgt.setPerformed(convertType(src.getPerformed())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) - tgt.addReport(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) - tgt.addComplication(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) - tgt.addFollowUp(convertCodeableConcept(t)); - tgt.setRequest(convertReference(src.getBasedOnFirstRep())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getActor())); - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getActor())); - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu2.model.ProcedureRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasReasonCodeableConcept()) - tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); - tgt.setOccurrence(convertType(src.getScheduled())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); -// for (org.hl7.fhir.dstu2.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setAuthoredOn(src.getOrderedOn()); -// tgt.setOrderer(convertReference(src.getOrderer())); - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ProcedureRequest tgt = new org.hl7.fhir.dstu2.model.ProcedureRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - tgt.setReason(convertType(src.getReasonCodeFirstRep())); - tgt.setScheduled(convertType(src.getOccurrence())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setOrderedOn(src.getAuthoredOn()); -// tgt.setOrderer(convertReference(src.getOrderer())); - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; - case DRAFT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; - case REQUESTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; - case ABORTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; -// case REQUESTED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.ABORTED; - default: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.dstu2.model.Provenance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - for (org.hl7.fhir.dstu2.model.Coding tc : t.getCoding()) - tgt.addReason(convertCoding(tc)); - for (org.hl7.fhir.dstu2.model.Coding t : src.getActivity().getCoding()) - tgt.setActivity(convertCoding(t)); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.dstu2.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) - tgt.addReason().addCoding(convertCoding(t)); - tgt.setActivity(new org.hl7.fhir.dstu2.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); -// tgt.setRole(convertCoding(src.getRole())); - tgt.setWho(convertReference(src.getActor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); -// tgt.setRole(convertCoding(src.getRole())); - if (src.hasWhoReference()) - tgt.setActor(convertReference(src.getWhoReference())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasReference()) - tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); - tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhatReference() && src.getWhatReference().hasReference()) - tgt.setReference(src.getWhatReference().getReference()); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.setAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; - default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; - default: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); - tgt.setTitle(root.getTitle()); - for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - tgt.addItem(convertQuestionnaireGroupComponent(root)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); - root.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) { - root.addConcept(convertCoding(t)); - } - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) - root.addGroup(convertQuestionnaireGroupComponent(t)); - else - root.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireQuestionType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) - tgt.addOption().setValue(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - else - tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - if (t.hasValueCoding()) - try { - tgt.addOption(convertCoding(t.getValueCoding())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); + public static void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); } - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; } - } - public org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; - case DATE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; - case DATETIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; - case TIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; - case STRING: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; - case TEXT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; - case URL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; - case CHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; - default: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + public static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getContext())); - - if (src.getItem().size() != 1) - throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? - - tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - if (t.hasAnswer()) - tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); - else - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu2.model.ReferralRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ReferralRequest tgt = new org.hl7.fhir.dstu3.model.ReferralRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertReferralStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setPriority(convertReferralPriorityCode(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setOccurrence(convertPeriod(src.getFulfillmentTime())); - tgt.getRequester().setAgent(convertReference(src.getRequester())); - tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.addReasonCode(convertCodeableConcept(src.getReason())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceRequested()) - tgt.addServiceRequested(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInfo(convertReference(t)); - return tgt; - } - - private ReferralPriority convertReferralPriorityCode(CodeableConcept priority) { - for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ASAP; + public static org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; } - return null; - } - public org.hl7.fhir.dstu2.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ReferralRequest tgt = new org.hl7.fhir.dstu2.model.ReferralRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertReferralStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setPriority(convertReferralPriorityCode(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setFulfillmentTime(convertPeriod(src.getOccurrencePeriod())); - tgt.setRequester(convertReference(src.getRequester().getAgent())); - tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getReasonCode()) - tgt.setReason(convertCodeableConcept(cc)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceRequested()) - tgt.addServiceRequested(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) - tgt.addSupportingInformation(convertReference(t)); - return tgt; - } - - private org.hl7.fhir.dstu2.model.CodeableConcept convertReferralPriorityCode(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority priority) { - org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; } - return cc; - } - - public org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus convertReferralStatus(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; - case REQUESTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED; - case ACCEPTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; - case REJECTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR; - case COMPLETED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL; + public static org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus convertReferralStatus(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.REJECTED; - default: return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.NULL; + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu2.model.RelatedPerson src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RelatedPerson tgt = new org.hl7.fhir.dstu2.model.RelatedPerson(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - if (!src.getName().isEmpty()) - tgt.setName(convertHumanName(src.getName().get(0))); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDate(src.getDate()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDateElement(src.getOccurrenceDateTimeType()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addServiceType(convertCodeableConcept(t)); - tgt.addActor(convertReference(src.getActor())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActorFirstRep())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.dstu3.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.hasConstrainedType()) - tgt.setType(src.getConstrainedType()); - else if (src.getSnapshot().hasElement()) - tgt.setType(src.getSnapshot().getElement().get(0).getPath()); - else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) - tgt.setType(src.getDifferential().getElement().get(0).getPath()); - else - tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); - tgt.setBaseDefinition(src.getBase()); - tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElementFirstRep().getType().clear(); - if (tgt.hasDifferential()) - tgt.getDifferential().getElementFirstRep().getType().clear(); - if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); -// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } -// for (ElementDefinition ed : tgt.getDifferential().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } - tgt.setType(tgt.getId()); + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - tgt.setConstrainedType(src.getType()); - tgt.setBase(src.getBaseDefinition()); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasBase()) { - if (tgt.hasDifferential()) - tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - return tgt; - } - private String tail(String base) { - return base.substring(base.lastIndexOf("/")+1); - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); + public static org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + public static org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - tgt.addHeader(src.getHeader()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - if (src.hasHeader()) - tgt.setHeaderElement(convertString(src.getHeader().get(0))); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + public static org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); - tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); -// tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SupplyRequest tgt = new org.hl7.fhir.dstu3.model.SupplyRequest(); - copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case FAILED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL; + public static org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilities(convertReference(src.getConformance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertReference(src.getCapabilities())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + public static org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + public static org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + public static org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setCaseSensitive(src.getCaseSensitive()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(src, cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); - tgt.setCode(src.getCode()); - tgt.setDefinition(src.getDefinition()); - tgt.setDisplay(src.getDisplay()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(cs, cc)); - for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) - tgt.addDesignation(convertCodeSystemDesignation(cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setUse(convertCoding(src.getUse())); - tgt.setLanguage(src.getLanguage()); - tgt.setValue(src.getValue()); - - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - if (src.hasCompose()) { - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - tgt.getCompose().setLockedDate(src.getLockedDate()); + public static org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; } - if (src.hasCodeSystem() && advisor != null) { - org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgtcs); - tgtcs.setUrl(src.getCodeSystem().getSystem()); - tgtcs.setIdentifier(convertIdentifier(src.getIdentifier())); - tgtcs.setVersion(src.getCodeSystem().getVersion()); - tgtcs.setName(src.getName()+" Code System"); - tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgtcs.setExperimental(src.getExperimental()); - tgtcs.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgtcs.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgtcs.setDate(src.getDate()); - tgtcs.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgtcs.addJurisdiction(convertCodeableConcept(t)); + + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + case URL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#" + src.getNameReference()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertElementDefinitionTypeComponent(t)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); else - tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); - tgtcs.setPurpose(src.getRequirements()); - tgtcs.setCopyright(src.getCopyright()); - tgtcs.setContent(CodeSystemContentMode.COMPLETE); - tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) - processConcept(tgtcs.getConcept(), cs, tgtcs); - advisor.handleCodeSystem(tgtcs, tgt); - tgt.setUserData("r2-cs", tgtcs); - tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); - } - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - private void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (cs.getAbstract()) - CodeSystemUtilities.setNotSelectable(tgtcs, ct); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertElementDefinitionTypeComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; } - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, tgtcs); - } - - private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) - ct.setAbstract(true); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + public static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } } - for (ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, srcCS); - } - - public org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier i : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(i)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setLockedDate(src.getCompose().getLockedDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - org.hl7.fhir.dstu3.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); - if (srcCS == null) - srcCS = advisor.getCodeSystem(src); - if (srcCS != null) { - tgt.getCodeSystem().setSystem(srcCS.getUrl()); - tgt.getCodeSystem().setVersion(srcCS.getVersion()); - tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) - processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); - + public static org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; + } } - tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - - public org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - if (noSystem == null || !t.getSystem().equals(noSystem)) - tgt.addInclude(convertConceptSetComponent(t)); + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } } - } - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - if (src.hasNote()) - tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); - for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + public static org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; + } } - } - public org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - public org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; - default: return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + public static org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) if (src.hasTarget()) + tgt.setTargetProfile(t.getValueAsString()); + else + tgt.setProfile(t.getValue()); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - - - public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2.model.Account) - return convertAccount((org.hl7.fhir.dstu2.model.Account) src); - if (src instanceof org.hl7.fhir.dstu2.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu2.model.Basic) - return convertBasic((org.hl7.fhir.dstu2.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu2.model.Binary) - return convertBinary((org.hl7.fhir.dstu2.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu2.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); - if (src instanceof org.hl7.fhir.dstu2.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.dstu2.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu2.model.Communication) - return convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.Composition) - return convertComposition((org.hl7.fhir.dstu2.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2.model.Condition) - return convertCondition((org.hl7.fhir.dstu2.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu2.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Contract) - return convertContract((org.hl7.fhir.dstu2.model.Contract) src); - if (src instanceof org.hl7.fhir.dstu2.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); - if (src instanceof org.hl7.fhir.dstu2.model.Device) - return convertDevice((org.hl7.fhir.dstu2.model.Device) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceComponent) - return convertDeviceComponent((org.hl7.fhir.dstu2.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); - if (src instanceof org.hl7.fhir.dstu2.model.DocumentManifest) - return convertDocumentManifest((org.hl7.fhir.dstu2.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu2.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu2.model.Flag) - return convertFlag((org.hl7.fhir.dstu2.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu2.model.Group) - return convertGroup((org.hl7.fhir.dstu2.model.Group) src); - if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu2.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.dstu2.model.ImagingStudy) src); - if (src instanceof org.hl7.fhir.dstu2.model.Immunization) - return convertImmunization((org.hl7.fhir.dstu2.model.Immunization) src); - if (src instanceof org.hl7.fhir.dstu2.model.ImmunizationRecommendation) - return convertImmunizationRecommendation((org.hl7.fhir.dstu2.model.ImmunizationRecommendation) src); - if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2.model.List_) - return convertList((org.hl7.fhir.dstu2.model.List_) src); - if (src instanceof org.hl7.fhir.dstu2.model.Location) - return convertLocation((org.hl7.fhir.dstu2.model.Location) src); - if (src instanceof org.hl7.fhir.dstu2.model.Media) - return convertMedia((org.hl7.fhir.dstu2.model.Media) src); - if (src instanceof org.hl7.fhir.dstu2.model.Medication) - return convertMedication((org.hl7.fhir.dstu2.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.dstu2.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.dstu2.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2.model.Observation) - return convertObservation((org.hl7.fhir.dstu2.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2.model.Organization) - return convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu2.model.Patient) - return convertPatient((org.hl7.fhir.dstu2.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu2.model.Person) - return convertPerson((org.hl7.fhir.dstu2.model.Person) src); - if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); - if (src instanceof org.hl7.fhir.dstu2.model.Procedure) - return convertProcedure((org.hl7.fhir.dstu2.model.Procedure) src); - if (src instanceof org.hl7.fhir.dstu2.model.ProcedureRequest) - return convertProcedureRequest((org.hl7.fhir.dstu2.model.ProcedureRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.Provenance) - return convertProvenance((org.hl7.fhir.dstu2.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.ReferralRequest) - return convertReferralRequest((org.hl7.fhir.dstu2.model.ReferralRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.dstu2.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu2.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2.model.Slot) - return convertSlot((org.hl7.fhir.dstu2.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2.model.Subscription) - return convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu2.model.Substance) - return convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu3.model.Basic) - return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu3.model.Binary) - return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); - if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu3.model.Communication) - return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu3.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.dstu3.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.Composition) - return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.Condition) - return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.Contract) - return convertContract((org.hl7.fhir.dstu3.model.Contract) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); - if (src instanceof org.hl7.fhir.dstu3.model.Device) - return convertDevice((org.hl7.fhir.dstu3.model.Device) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) - return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) - return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu3.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.dstu3.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.dstu3.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu3.model.Flag) - return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu3.model.Group) - return convertGroup((org.hl7.fhir.dstu3.model.Group) src); - if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); - if (src instanceof org.hl7.fhir.dstu3.model.Immunization) - return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImmunizationRecommendation) - return convertImmunizationRecommendation((org.hl7.fhir.dstu3.model.ImmunizationRecommendation) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.ListResource) - return convertList((org.hl7.fhir.dstu3.model.ListResource) src); - if (src instanceof org.hl7.fhir.dstu3.model.Location) - return convertLocation((org.hl7.fhir.dstu3.model.Location) src); - if (src instanceof org.hl7.fhir.dstu3.model.Media) - return convertMedia((org.hl7.fhir.dstu3.model.Media) src); - if (src instanceof org.hl7.fhir.dstu3.model.Medication) - return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.dstu3.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.dstu3.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.Observation) - return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Organization) - return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu3.model.Patient) - return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu3.model.Person) - return convertPerson((org.hl7.fhir.dstu3.model.Person) src); - if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); - if (src instanceof org.hl7.fhir.dstu3.model.Procedure) - return convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); - if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) - return convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.Provenance) - return convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.ReferralRequest) - return convertReferralRequest((org.hl7.fhir.dstu3.model.ReferralRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu3.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Slot) - return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu3.model.Specimen) - return convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Subscription) - return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu3.model.Substance) - return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.dstu3.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - private org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus convertSpecimenStatus(Specimen.SpecimenStatus status) { - if (status == null) { - return null; + public static org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUriToCode(src.getCodeElement())); + if (src.hasTarget()) { + if (src.hasTargetProfile()) + tgt.addProfile(src.getTargetProfile()); + } else if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); + return tgt; } - switch(status) { - case AVAILABLE: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.AVAILABLE; - case UNAVAILABLE: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.UNAVAILABLE; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.ENTEREDINERROR; - case UNSATISFACTORY: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.UNSATISFACTORY; - case NULL: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.NULL; - default: return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.NULL; + + public static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } } - } - public org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasProcedure()) - tgt.setProcedure(convertCodeableConcept(src.getProcedure())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) - tgt.addAdditive(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCapacity()) - tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); - if (src.hasSpecimenQuantity()) - tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); - if (src.hasAdditive()) - tgt.setAdditive(convertType(src.getAdditive())); - return tgt; - } - public org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent(); - copyElement(src, tgt); - if (src.hasCollector()) - tgt.setCollector(convertReference(src.getCollector())); - if (src.hasCollected()) - tgt.setCollected(convertType(src.getCollected())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - return tgt; - } - - private org.hl7.fhir.dstu2.model.Specimen convertSpecimen(Specimen src) { - if (src == null) { - return null; + public static org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; + } } - org.hl7.fhir.dstu2.model.Specimen tgt = new org.hl7.fhir.dstu2.model.Specimen(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAccessionIdentifier()) - tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertSpecimenStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasReceivedTime()) - tgt.setReceivedTime(src.getReceivedTime()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.addParent(convertReference(t)); - if (src.hasCollection()) - tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) - tgt.addTreatment(convertSpecimenProcessingComponent(t)); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) - tgt.addContainer(convertSpecimenContainerComponent(t)); - return tgt; - } + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "ClinicalImpression", "Communication", "CommunicationRequest", "Composition", - "ConceptMap", "Condition", "CapabilityStatement", "Contract", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", - "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", - "ListResource", "Location", "Media", "Medication", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", - "Person", "Practitioner", "Procedure", "ProcedureRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", - "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); - } + public static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + public static org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeType) + return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateType) + return convertDate((org.hl7.fhir.dstu2.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IdType) + return convertId((org.hl7.fhir.dstu2.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2.model.OidType) + return convertOid((org.hl7.fhir.dstu2.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.StringType) + return convertString((org.hl7.fhir.dstu2.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2.model.TimeType) + return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UriType) + return convertUri((org.hl7.fhir.dstu2.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.Extension) + return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2.model.Coding) + return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2.model.Period) + return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2.model.Range) + return convertRange((org.hl7.fhir.dstu2.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2.model.Reference) + return convertReference((org.hl7.fhir.dstu2.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2.model.Signature) + return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2.model.Address) + return convertAddress((org.hl7.fhir.dstu2.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu2.model.ElementDefinition) src, new ArrayList()); + if (src instanceof org.hl7.fhir.dstu2.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2.model.Meta) + return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2.model.Timing) + return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu2.model.Age) + return convertAge((org.hl7.fhir.dstu2.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2.model.Count) + return convertCount((org.hl7.fhir.dstu2.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2.model.Distance) + return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Duration) + return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2.model.Money) + return convertMoney((org.hl7.fhir.dstu2.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu3.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(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(convertExtension(t)); + for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(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(convertExtension(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + + public static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; + } + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; + } + + public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + static public boolean hasConcept(org.hl7.fhir.dstu3.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu3.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + static public boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CANCEL: + return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL; + case POLL: + return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL; + case REPROCESS: + return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: + return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS; + default: + return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CANCEL: + return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.CANCEL; + case POLL: + return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.POLL; + case REPROCESS: + return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: + return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.STATUS; + default: + return org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu2.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: + return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + return tgt; + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Parameters) + return Parameters10_30.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2.model.Account) + return Account10_30.convertAccount((org.hl7.fhir.dstu2.model.Account) src); + if (src instanceof org.hl7.fhir.dstu2.model.Appointment) + return Appointment10_30.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) + return AppointmentResponse10_30.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) + return AuditEvent10_30.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu2.model.Basic) + return Basic10_30.convertBasic((org.hl7.fhir.dstu2.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu2.model.Binary) + return Binary10_30.convertBinary((org.hl7.fhir.dstu2.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu2.model.Bundle) + return Bundle10_30.convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) + return CarePlan10_30.convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu2.model.ClinicalImpression) + return ClinicalImpression10_30.convertClinicalImpression((org.hl7.fhir.dstu2.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu2.model.Communication) + return Communication10_30.convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) + return CommunicationRequest10_30.convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.Composition) + return Composition10_30.convertComposition((org.hl7.fhir.dstu2.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) + return ConceptMap10_30.convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2.model.Condition) + return Condition10_30.convertCondition((org.hl7.fhir.dstu2.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Conformance) + return Conformance10_30.convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Contract) + return Contract10_30.convertContract((org.hl7.fhir.dstu2.model.Contract) src); + if (src instanceof org.hl7.fhir.dstu2.model.DataElement) + return DataElement10_30.convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) + return DetectedIssue10_30.convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu2.model.Device) + return Device10_30.convertDevice((org.hl7.fhir.dstu2.model.Device) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceComponent) + return DeviceComponent10_30.convertDeviceComponent((org.hl7.fhir.dstu2.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) + return DeviceMetric10_30.convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) + return DeviceUseStatement10_30.convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) + return DiagnosticReport10_30.convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu2.model.DocumentManifest) + return DocumentManifest10_30.convertDocumentManifest((org.hl7.fhir.dstu2.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) + return DocumentReference10_30.convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu2.model.Encounter) + return Encounter10_30.convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) + return EnrollmentRequest10_30.convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) + return EnrollmentResponse10_30.convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) + return EpisodeOfCare10_30.convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) + return FamilyMemberHistory10_30.convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu2.model.Flag) + return Flag10_30.convertFlag((org.hl7.fhir.dstu2.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu2.model.Group) + return Group10_30.convertGroup((org.hl7.fhir.dstu2.model.Group) src); + if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) + return HealthcareService10_30.convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImagingStudy) + return ImagingStudy10_30.convertImagingStudy((org.hl7.fhir.dstu2.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.dstu2.model.Immunization) + return Immunization10_30.convertImmunization((org.hl7.fhir.dstu2.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImmunizationRecommendation) + return ImmunizationRecommendation10_30.convertImmunizationRecommendation((org.hl7.fhir.dstu2.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) + return ImplementationGuide10_30.convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2.model.List_) + return List10_30.convertList((org.hl7.fhir.dstu2.model.List_) src); + if (src instanceof org.hl7.fhir.dstu2.model.Location) + return Location10_30.convertLocation((org.hl7.fhir.dstu2.model.Location) src); + if (src instanceof org.hl7.fhir.dstu2.model.Media) + return Media10_30.convertMedia((org.hl7.fhir.dstu2.model.Media) src); + if (src instanceof org.hl7.fhir.dstu2.model.Medication) + return Medication10_30.convertMedication((org.hl7.fhir.dstu2.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) + return MedicationDispense10_30.convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) + return MedicationStatement10_30.convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) + return MessageHeader10_30.convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) + return NamingSystem10_30.convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2.model.Observation) + return Observation10_30.convertObservation((org.hl7.fhir.dstu2.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) + return OperationDefinition10_30.convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) + return OperationOutcome10_30.convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2.model.Organization) + return Organization10_30.convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu2.model.Patient) + return Patient10_30.convertPatient((org.hl7.fhir.dstu2.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu2.model.Person) + return Person10_30.convertPerson((org.hl7.fhir.dstu2.model.Person) src); + if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) + return Practitioner10_30.convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu2.model.Procedure) + return Procedure10_30.convertProcedure((org.hl7.fhir.dstu2.model.Procedure) src); + if (src instanceof org.hl7.fhir.dstu2.model.ProcedureRequest) + return ProcedureRequest10_30.convertProcedureRequest((org.hl7.fhir.dstu2.model.ProcedureRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.Provenance) + return Provenance10_30.convertProvenance((org.hl7.fhir.dstu2.model.Provenance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) + return Questionnaire10_30.convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) + return QuestionnaireResponse10_30.convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.ReferralRequest) + return ReferralRequest10_30.convertReferralRequest((org.hl7.fhir.dstu2.model.ReferralRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.RelatedPerson) + return RelatedPerson10_30.convertRelatedPerson((org.hl7.fhir.dstu2.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) + return RiskAssessment10_30.convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu2.model.Schedule) + return Schedule10_30.convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) + return SearchParameter10_30.convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2.model.Slot) + return Slot10_30.convertSlot((org.hl7.fhir.dstu2.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) + return StructureDefinition10_30.convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Subscription) + return Subscription10_30.convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu2.model.Substance) + return Substance10_30.convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) + return SupplyDelivery10_30.convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) + return SupplyRequest10_30.convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.TestScript) + return TestScript10_30.convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) + return ValueSet10_30.convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return Parameters10_30.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.Appointment) + return Appointment10_30.convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) + return AppointmentResponse10_30.convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) + return AuditEvent10_30.convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu3.model.Basic) + return Basic10_30.convertBasic((org.hl7.fhir.dstu3.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu3.model.Binary) + return Binary10_30.convertBinary((org.hl7.fhir.dstu3.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return Bundle10_30.convertBundle((org.hl7.fhir.dstu3.model.Bundle) src, advisor); + if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) + return CarePlan10_30.convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) + return ClinicalImpression10_30.convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu3.model.Communication) + return Communication10_30.convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu3.model.CommunicationRequest) + return CommunicationRequest10_30.convertCommunicationRequest((org.hl7.fhir.dstu3.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.Composition) + return Composition10_30.convertComposition((org.hl7.fhir.dstu3.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return ConceptMap10_30.convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Condition) + return Condition10_30.convertCondition((org.hl7.fhir.dstu3.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return Conformance10_30.convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.Contract) + return Contract10_30.convertContract((org.hl7.fhir.dstu3.model.Contract) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return DataElement10_30.convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) + return DetectedIssue10_30.convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu3.model.Device) + return Device10_30.convertDevice((org.hl7.fhir.dstu3.model.Device) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) + return DeviceComponent10_30.convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) + return DeviceMetric10_30.convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) + return DeviceUseStatement10_30.convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) + return DiagnosticReport10_30.convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) + return DocumentManifest10_30.convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) + return DocumentReference10_30.convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu3.model.Encounter) + return Encounter10_30.convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentRequest) + return EnrollmentRequest10_30.convertEnrollmentRequest((org.hl7.fhir.dstu3.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentResponse) + return EnrollmentResponse10_30.convertEnrollmentResponse((org.hl7.fhir.dstu3.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) + return EpisodeOfCare10_30.convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) + return FamilyMemberHistory10_30.convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu3.model.Flag) + return Flag10_30.convertFlag((org.hl7.fhir.dstu3.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu3.model.Group) + return Group10_30.convertGroup((org.hl7.fhir.dstu3.model.Group) src); + if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) + return HealthcareService10_30.convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) + return ImagingStudy10_30.convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.dstu3.model.Immunization) + return Immunization10_30.convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImmunizationRecommendation) + return ImmunizationRecommendation10_30.convertImmunizationRecommendation((org.hl7.fhir.dstu3.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return ImplementationGuide10_30.convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.ListResource) + return List10_30.convertList((org.hl7.fhir.dstu3.model.ListResource) src); + if (src instanceof org.hl7.fhir.dstu3.model.Location) + return Location10_30.convertLocation((org.hl7.fhir.dstu3.model.Location) src); + if (src instanceof org.hl7.fhir.dstu3.model.Media) + return Media10_30.convertMedia((org.hl7.fhir.dstu3.model.Media) src); + if (src instanceof org.hl7.fhir.dstu3.model.Medication) + return Medication10_30.convertMedication((org.hl7.fhir.dstu3.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) + return MedicationDispense10_30.convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) + return MedicationStatement10_30.convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) + return MessageHeader10_30.convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return NamingSystem10_30.convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Observation) + return Observation10_30.convertObservation((org.hl7.fhir.dstu3.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return OperationDefinition10_30.convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return OperationOutcome10_30.convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Organization) + return Organization10_30.convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu3.model.Patient) + return Patient10_30.convertPatient((org.hl7.fhir.dstu3.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu3.model.Person) + return Person10_30.convertPerson((org.hl7.fhir.dstu3.model.Person) src); + if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) + return Practitioner10_30.convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu3.model.Procedure) + return Procedure10_30.convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); + if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) + return ProcedureRequest10_30.convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.Provenance) + return Provenance10_30.convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return Questionnaire10_30.convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return QuestionnaireResponse10_30.convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.ReferralRequest) + return ReferralRequest10_30.convertReferralRequest((org.hl7.fhir.dstu3.model.ReferralRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) + return RelatedPerson10_30.convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) + return RiskAssessment10_30.convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu3.model.Schedule) + return Schedule10_30.convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return SearchParameter10_30.convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Slot) + return Slot10_30.convertSlot((org.hl7.fhir.dstu3.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu3.model.Specimen) + return Specimen10_30.convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return StructureDefinition10_30.convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Subscription) + return Subscription10_30.convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu3.model.Substance) + return Substance10_30.convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) + return SupplyDelivery10_30.convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyRequest) + return SupplyRequest10_30.convertSupplyRequest((org.hl7.fhir.dstu3.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return TestScript10_30.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return ValueSet10_30.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "ClinicalImpression", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "Contract", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "ListResource", "Location", "Media", "Medication", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Procedure", "ProcedureRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); + } + + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { + return convertResource(src, null); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { + return convertResource(src, null); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java index b71fab608..dc7693910 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java @@ -20,51 +20,31 @@ package org.hl7.fhir.convertors; * #L% */ - -import java.util.ArrayList; -import java.util.List; - +import org.hl7.fhir.convertors.conv10_40.*; import org.hl7.fhir.dstu2.model.CodeableConcept; -import org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind; import org.hl7.fhir.dstu2.model.Parameters; import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent; import org.hl7.fhir.dstu2.model.Reference; import org.hl7.fhir.dstu2.utils.ToolingExtensions; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.model.Annotation; -import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.CanonicalType; -import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent; -import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent; -import org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction; import org.hl7.fhir.r4.model.CodeSystem; -import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode; import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent; -import org.hl7.fhir.r4.model.ConceptMap; -import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.r4.model.ContactDetail; -import org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus; -import org.hl7.fhir.r4.model.Dosage; import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent; -import org.hl7.fhir.r4.model.ElementDefinition; import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; import org.hl7.fhir.r4.model.Enumeration; -import org.hl7.fhir.r4.model.Enumerations.FHIRAllTypes; -import org.hl7.fhir.r4.model.Enumerations.SearchParamType; import org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent; -import org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration; -import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; -import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; import org.hl7.fhir.r4.model.TerminologyCapabilities; import org.hl7.fhir.r4.model.Timing.EventTiming; -import org.hl7.fhir.r4.model.Type; import org.hl7.fhir.r4.terminologies.CodeSystemUtilities; import org.hl7.fhir.utilities.Utilities; +import java.util.ArrayList; +import java.util.List; + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -93,12246 +73,2687 @@ import org.hl7.fhir.utilities.Utilities; POSSIBILITY OF SUCH DAMAGE. */ - -// Generated on Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 - - public class VersionConvertor_10_40 { - private static List CANONICAL_URLS = new ArrayList(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } + static public List CANONICAL_URLS = new ArrayList(); - public VersionConvertorAdvisor40 advisor; - - public VersionConvertor_10_40(VersionConvertorAdvisor40 advisor) { - super(); - this.advisor = advisor; - } - - public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDateTimeToDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDateTimeToDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { + org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { - org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { + org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { - org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { + org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { - org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { + org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { + org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { - org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } - public org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2.model.Reference) - tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); - else + public static org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; + return tgt; } - } - public org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; + public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - public org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - - - public org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; + public static org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - tgt.setSigFormat(src.getContentType()); - tgt.setData(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getSigFormat()); - tgt.setBlob(src.getData()); - return tgt; - } - - public org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - case URL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceName(src.getName()); - tgt.setId(src.getName()); - } - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasNameReference()) - tgt.setContentReference("#"+src.getNameReference()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertElementDefinitionTypeComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu2.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - if (!tgt.hasId()) - tgt.setId(tgt.getPath()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - else - tgt.setName(src.getId()); - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - tgt.setShort(src.getShort()); - tgt.setDefinition(src.getDefinition()); - tgt.setComments(src.getComment()); - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setNameReference(src.getContentReference().substring(1)); - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertElementDefinitionTypeComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - tgt.setMustSupport(src.getMustSupport()); - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - org.hl7.fhir.dstu2.model.ElementDefinition slicingElement = context.get(pos); - for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) { - boolean isExists = false; - if (!t.asStringValue().contains("@")) { - int slices = 0; - boolean existsSlicePresent = false; - boolean notExistsSlicePresent = false; - String existsPath = slicingElement.getPath() + "." + t.asStringValue(); - for (int i = pos + 1; i < context.size(); i++) { - org.hl7.fhir.dstu2.model.ElementDefinition e = context.get(i); - if (e.getPath().equals(slicingElement.getPath())) - slices++; - else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) - break; - else if (e.getPath().equals(existsPath)) { - if (e.hasMin() && e.getMin() > 0) - existsSlicePresent = true; - else if (e.hasMax() && e.getMax().equals("0")) - notExistsSlicePresent = true; - } + public static org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; } - isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); - } - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); } - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public void convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - } - if (tgt.hasTarget()) { - for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) - tgt.addTargetProfile(u.getValue()); - } else { - for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) - tgt.addProfile(u.getValue()); - } - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregationElement().setValue(a)); - } - } - - public void convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - list.add(tgt); - if (src.hasTarget()) { - for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { - tgt.addProfile(u.getValue()); - } - } else { - for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { - tgt.addProfile(u.getValue()); - } - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.r4.model.Type vs = convertType(src.getValueSet()); - if (vs != null) { - tgt.setValueSet(vs instanceof org.hl7.fhir.r4.model.Reference ? ((org.hl7.fhir.r4.model.Reference) vs).getReference() : vs.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); - tgt.addWhen(convertEventTiming(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setCurrency(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setCode(src.getCurrency()); - return tgt; - } - - public org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeType) - return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateType) - return convertDate((org.hl7.fhir.dstu2.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IdType) - return convertId((org.hl7.fhir.dstu2.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2.model.OidType) - return convertOid((org.hl7.fhir.dstu2.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.StringType) - return convertString((org.hl7.fhir.dstu2.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2.model.TimeType) - return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UriType) - return convertUri((org.hl7.fhir.dstu2.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.Extension) - return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2.model.Coding) - return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2.model.Period) - return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2.model.Range) - return convertRange((org.hl7.fhir.dstu2.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2.model.Reference) - return convertReference((org.hl7.fhir.dstu2.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2.model.Signature) - return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2.model.Address) - return convertAddress((org.hl7.fhir.dstu2.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2.model.Meta) - return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2.model.Timing) - return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu2.model.Age) - return convertAge((org.hl7.fhir.dstu2.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2.model.Count) - return convertCount((org.hl7.fhir.dstu2.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2.model.Distance) - return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Duration) - return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2.model.Money) - return convertMoney((org.hl7.fhir.dstu2.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r4.model.BooleanType) - return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r4.model.CodeType) - return convertCode((org.hl7.fhir.r4.model.CodeType) src); - if (src instanceof org.hl7.fhir.r4.model.DateType) - return convertDate((org.hl7.fhir.r4.model.DateType) src); - if (src instanceof org.hl7.fhir.r4.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r4.model.DecimalType) - return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r4.model.IdType) - return convertId((org.hl7.fhir.r4.model.IdType) src); - if (src instanceof org.hl7.fhir.r4.model.InstantType) - return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r4.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r4.model.OidType) - return convertOid((org.hl7.fhir.r4.model.OidType) src); - if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r4.model.StringType) - return convertString((org.hl7.fhir.r4.model.StringType) src); - if (src instanceof org.hl7.fhir.r4.model.TimeType) - return convertTime((org.hl7.fhir.r4.model.TimeType) src); - if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r4.model.UriType) - return convertUri((org.hl7.fhir.r4.model.UriType) src); - if (src instanceof org.hl7.fhir.r4.model.UuidType) - return convertUuid((org.hl7.fhir.r4.model.UuidType) src); - if (src instanceof org.hl7.fhir.r4.model.Extension) - return convertExtension((org.hl7.fhir.r4.model.Extension) src); - if (src instanceof org.hl7.fhir.r4.model.Narrative) - return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); - if (src instanceof org.hl7.fhir.r4.model.Annotation) - return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); - if (src instanceof org.hl7.fhir.r4.model.Attachment) - return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); - if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r4.model.Coding) - return convertCoding((org.hl7.fhir.r4.model.Coding) src); - if (src instanceof org.hl7.fhir.r4.model.Identifier) - return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); - if (src instanceof org.hl7.fhir.r4.model.Period) - return convertPeriod((org.hl7.fhir.r4.model.Period) src); - if (src instanceof org.hl7.fhir.r4.model.Quantity) - return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); - if (src instanceof org.hl7.fhir.r4.model.Range) - return convertRange((org.hl7.fhir.r4.model.Range) src); - if (src instanceof org.hl7.fhir.r4.model.Ratio) - return convertRatio((org.hl7.fhir.r4.model.Ratio) src); - if (src instanceof org.hl7.fhir.r4.model.Reference) - return convertReference((org.hl7.fhir.r4.model.Reference) src); - if (src instanceof org.hl7.fhir.r4.model.SampledData) - return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); - if (src instanceof org.hl7.fhir.r4.model.Signature) - return convertSignature((org.hl7.fhir.r4.model.Signature) src); - if (src instanceof org.hl7.fhir.r4.model.Address) - return convertAddress((org.hl7.fhir.r4.model.Address) src); - if (src instanceof org.hl7.fhir.r4.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r4.model.HumanName) - return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); - if (src instanceof org.hl7.fhir.r4.model.Meta) - return convertMeta((org.hl7.fhir.r4.model.Meta) src); - if (src instanceof org.hl7.fhir.r4.model.Timing) - return convertTiming((org.hl7.fhir.r4.model.Timing) src); - if (src instanceof org.hl7.fhir.r4.model.Age) - return convertAge((org.hl7.fhir.r4.model.Age) src); - if (src instanceof org.hl7.fhir.r4.model.Count) - return convertCount((org.hl7.fhir.r4.model.Count) src); - if (src instanceof org.hl7.fhir.r4.model.Distance) - return convertDistance((org.hl7.fhir.r4.model.Distance) src); - if (src instanceof org.hl7.fhir.r4.model.Duration) - return convertDuration((org.hl7.fhir.r4.model.Duration) src); - if (src instanceof org.hl7.fhir.r4.model.Money) - return convertMoney((org.hl7.fhir.r4.model.Money) src); - if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(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()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r4.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - - public org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - tgt.setImplicitRules(src.getImplicitRules()); - tgt.setLanguage(src.getLanguage()); - } - public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; - } - } - - - - public org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r4.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - private org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case INPROCESS: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case COMPLETED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - private org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasEvent()) { - tgt.setType(convertCoding(src.getEvent().getType())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) - tgt.addSubtype(convertCoding(t)); - tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); - tgt.setRecorded(src.getEvent().getDateTime()); - tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); - tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) - tgt.addPurposeOfEvent().addCoding(convertCoding(t)); - } - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); - copyDomainResource(src, tgt); - tgt.getEvent().setType(convertCoding(src.getType())); - for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) - tgt.getEvent().addSubtype(convertCoding(t)); - tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); - tgt.getEvent().setDateTime(src.getRecorded()); - tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); - tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) - for (org.hl7.fhir.r4.model.Coding cc : t.getCoding()) - tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addParticipant(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addObject(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setWho(convertReference(src.getReference())); - if (src.hasUserId()) - tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) - tgt.addPurposeOfUse().addCoding(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - if (src.getWho().hasIdentifier()) - tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); - if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) - tgt.setReference(convertReference(src.getWho())); - } - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) - for (org.hl7.fhir.r4.model.Coding cc : t.getCoding()) - tgt.addPurposeOfUse(convertCoding(cc)); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; - case _2: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; - case _3: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; - case _5: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; - } - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - if (src.hasIdentifier()) - tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - if (src.hasObserver()) - tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasReference()) - tgt.setWhat(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); - copyElement(src, tgt); - if (src.hasWhat()) { - if (src.getWhat().hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); - if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) - tgt.setReference(convertReference(src.getWhat())); - } - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasValue()) - tgt.setValue(new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasValueStringType()) - tgt.setValue(src.getValueStringType().getValue().getBytes()); - else if (src.hasValueBase64BinaryType()) - tgt.setValue(src.getValueBase64BinaryType().getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (advisor.ignoreEntry(src)) - return null; - - org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource()); - if (res == null) - res = convertResource(src.getResource()); - tgt.setResource(res); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - if (!tgt.hasAuthor()) - tgt.setAuthor(convertReference(t)); - else - tgt.addContributor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAuthor()) - tgt.addAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r4.model.Reference t : src.getContributor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; - case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED; - default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; - case REVOKED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; - } - } - -// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// - public org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.r4.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); -// tgt.setKind().add(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setDoNotPerform(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - // tgt.setCategory(convertCodeableConcept(src.getKind())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getDoNotPerform()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - -// public org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu2.model.ClinicalImpression src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ClinicalImpression tgt = new org.hl7.fhir.r4.model.ClinicalImpression(); -// copyDomainResource(src, tgt); -// tgt.setSubject(convertReference(src.getPatient())); -// tgt.setAssessor(convertReference(src.getAssessor())); -// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setDescription(src.getDescription()); -// tgt.setPrevious(convertReference(src.getPrevious())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getProblem()) -// tgt.addProblem(convertReference(t)); -//// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); -// tgt.addProtocol(src.getProtocol()); -// tgt.setSummary(src.getSummary()); -// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) -// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); -// if (src.hasPrognosis()) -// tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); -//// for (org.hl7.fhir.dstu2.model.Reference t : src.getPlan()) -//// tgt.addPlan(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r4.model.ClinicalImpression src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ClinicalImpression tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getSubject())); -// tgt.setAssessor(convertReference(src.getAssessor())); -// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setDescription(src.getDescription()); -// tgt.setPrevious(convertReference(src.getPrevious())); -// for (org.hl7.fhir.r4.model.Reference t : src.getProblem()) -// tgt.addProblem(convertReference(t)); -//// for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); -// for (UriType t : src.getProtocol()) -// tgt.setProtocol(t.asStringValue()); -// tgt.setSummary(src.getSummary()); -// for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) -// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); -// tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); -//// for (org.hl7.fhir.r4.model.Reference t : src.getPlan()) -//// tgt.addPlan(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INPROGRESS: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; -// case COMPLETED: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DRAFT: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; -// case COMPLETED: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; -// } -// } -// -//// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -//// if (src == null || src.isEmpty()) -//// return null; -//// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -//// copyElement(src, tgt); -//// tgt.setCode(convertCodeableConcept(src.getCode())); -//// for (org.hl7.fhir.dstu2.model.Reference t : src.getItem()) -//// tgt.addItem(convertReference(t)); -//// return tgt; -//// } -//// -//// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -//// if (src == null || src.isEmpty()) -//// return null; -//// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -//// copyElement(src, tgt); -//// tgt.setCode(convertCodeableConcept(src.getCode())); -//// for (org.hl7.fhir.r4.model.Reference t : src.getItem()) -//// tgt.addItem(convertReference(t)); -//// return tgt; -//// } -// -// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertCodeableConcept(src.getItem())); -//// tgt.setCause(src.getCause()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent(); -// copyElement(src, tgt); -// if (src.hasItemCodeableConcept()) -// try { -// tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); -// } catch (org.hl7.fhir.exceptions.FHIRException e) { -// } -//// tgt.setCause(src.getCause()); -// return tgt; -// } -// - public org.hl7.fhir.r4.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Communication tgt = new org.hl7.fhir.r4.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.r4.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ONHOLD; - case REJECTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; - case FAILED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE; - default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; - case NOTDONE: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.r4.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CommunicationRequest tgt = new org.hl7.fhir.r4.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setOccurrence(convertType(src.getScheduled())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setAuthoredOn(src.getRequestedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { - for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP; - } - return null; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setScheduled(convertType(src.getOccurrence())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setRequestedOn(src.getAuthoredOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) { - org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; - case PLANNED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case REQUESTED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ONHOLD; - case REJECTED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; -// case FAILED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; -// case PLANNED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addCategory(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - try { - tgt.setConfidentiality(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - tgt.setConfidentiality(src.getConfidentiality().toCode()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.addMode(convertCompositionAttestationMode(src.getMode())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - try { - tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - tgt.setMode(src.getMode().toCode()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; - - } - - public org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - org.hl7.fhir.r4.model.Type r = convertType(src.getSource()); - tgt.setSource(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r); - r = convertType(src.getTarget()); - tgt.setTarget(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r); - for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - public org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - - private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); - } - return res; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getSource()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getTarget()); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComments(src.getComment()); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getCodeSystem()); - tgt.setValue(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setCodeSystem(src.getSystem()); - tgt.setCode(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Condition tgt = new org.hl7.fhir.r4.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasDateRecorded()) - tgt.setRecordedDate(src.getDateRecorded()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.addStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.r4.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasRecordedDate()) - tgt.setDateRecorded(src.getRecordedDate()); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.setCategory(convertCodeableConcept(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); - for (org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); - cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); - return cc; - } - - private static String convertConditionClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - for (org.hl7.fhir.r4.model.Coding c : src.getCoding()) { - if ("http://hl7.org/fhir/condition-clinical".equals(c.getSystem())) - return c.getCode(); - } - return null; - } - - private static org.hl7.fhir.r4.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); - switch (src) { - case PROVISIONAL: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); - return cc; - case DIFFERENTIAL: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); - return cc; - case CONFIRMED: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); - return cc; - case REFUTED: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); - return cc; - case ENTEREDINERROR: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); - return cc; - default: return null; - } - } - - - private static org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; - } - - - - public org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - tgt.addCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode()) - tgt.setCode(convertCodeableConcept(cc)); - for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { - CanonicalType dst = new CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { - Reference dst = new Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - 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())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) -// tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - 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())); - for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (CapabilityStatementRestComponent r : src.getRest()) - for (CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(convertCanonicalToReference(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; - } - } - -// public org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; -// } -// } - - public org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) - tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - boolean batch = false; - boolean transaction = false; - for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { - if (t.getCode().equals(SystemRestfulInteraction.BATCH)) - batch = true; - else - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) - transaction = true; - } - if (batch) - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); - else - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; - } - } - - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); - org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - - public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; - } - } - -// public org.hl7.fhir.r4.model.Contract convertContract(org.hl7.fhir.dstu2.model.Contract src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract tgt = new org.hl7.fhir.r4.model.Contract(); -// copyDomainResource(src, tgt); -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent t : src.getRule()) -// tgt.setRule(convertComputableLanguageComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract convertContract(org.hl7.fhir.r4.model.Contract src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract tgt = new org.hl7.fhir.dstu2.model.Contract(); -// copyDomainResource(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// if (src.hasRule()) -// tgt.addRule(convertComputableLanguageComponent(src.getRule())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu2.model.Contract.ActorComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// tgt.setActor(convertReference(src.getEntity())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ActorComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertReference(src.getActor())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu2.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// tgt.setType(convertCoding(src.getType())); -// tgt.setParty(convertReference(src.getParty())); -// if (src.hasSignature()) -// tgt.addSignature(new org.hl7.fhir.r4.model.Signature().setData(src.getSignature().getBytes())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu2.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// tgt.setType(convertCoding(src.getType())); -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) -// tgt.setSignature(Base64.encodeBase64String(t.getData())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu2.model.Contract.TermComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent(); -// copyElement(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermActorComponent t : src.getActor()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermComponent(); -// copyElement(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent()) -// tgt.addActor(convertTermAgentComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu2.model.Contract.TermActorComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// tgt.setActor(convertReference(src.getEntity())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermActorComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertReference(src.getActor())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } - - - public org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); - } - tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public org.hl7.fhir.dstu2.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DataElement tgt = new org.hl7.fhir.dstu2.model.DataElement(); -// copyDomainResource(src, tgt); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setVersion(src.getVersion()); -// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// tgt.setPublisher(src.getPublisher()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setName(src.getName()); -// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertDataElementContactComponent(t)); -// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) -// if (t.hasValueCodeableConcept()) -// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); -// tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; -// } -// } - - public org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - -// public org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// tgt.setIdentity(src.getIdentity()); -// tgt.setUri(src.getUri()); -// tgt.setName(src.getName()); -// tgt.setComments(src.getComment()); -// return tgt; -// } - - public org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCode(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setIdentified(convertDateTime(src.getDateElement())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCode())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasIdentifiedDateTimeType()) - tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - -// public org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.dstu2.model.Device src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Device tgt = new org.hl7.fhir.r4.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setUdi((new org.hl7.fhir.r4.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); -// tgt.setStatus(convertDeviceStatus(src.getStatus())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setManufacturer(src.getManufacturer()); -// tgt.setManufactureDate(src.getManufactureDate()); -// tgt.setExpirationDate(src.getExpiry()); -// tgt.setModel(src.getModel()); -// tgt.setVersion(src.getVersion()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Device convertDevice(org.hl7.fhir.r4.model.Device src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Device tgt = new org.hl7.fhir.dstu2.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(src.getUdi().getDeviceIdentifier()); -// tgt.setStatus(convertDeviceStatus(src.getStatus())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setManufacturer(src.getManufacturer()); -// tgt.setManufactureDate(src.getManufactureDate()); -// tgt.setExpiry(src.getExpirationDate()); -// tgt.setModel(src.getModel()); -// tgt.setVersion(src.getVersion()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE; -// case NOTAVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; -// case INACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; -// } -// } -// -// public org.hl7.fhir.r4.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.DeviceComponent tgt = new org.hl7.fhir.r4.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setLastSystemChange(src.getLastSystemChange()); -// tgt.setSource(convertReference(src.getSource())); -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r4.model.DeviceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// tgt.setLastSystemChange(src.getLastSystemChange()); -// tgt.setSource(convertReference(src.getSource())); -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -// } -// -// public org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// - public org.hl7.fhir.r4.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DeviceMetric tgt = new org.hl7.fhir.r4.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r4.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - if (src.hasBodySiteCodeableConcept()) - tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) - tgt.addNote().setText(t.getValue()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - tgt.setBodySite(convertType(src.getBodySite())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addIndication(convertCodeableConcept(t)); - for (Annotation t : src.getNote()) - tgt.addNotes(t.getText()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - -// public org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; -// default: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; -// default: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; -// } -// } - - - public org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DiagnosticReport tgt = new org.hl7.fhir.r4.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addMedia(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addConclusionCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.r4.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getConclusionCode()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - -// public org.hl7.fhir.r4.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu2.model.DocumentManifest src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.DocumentManifest tgt = new org.hl7.fhir.r4.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setSubject(convertReference(src.getSubject())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// tgt.setCreated(src.getCreated()); -// tgt.setSource(src.getSource()); -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r4.model.DocumentManifest src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DocumentManifest tgt = new org.hl7.fhir.dstu2.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setSubject(convertReference(src.getSubject())); -// for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// tgt.setCreated(src.getCreated()); -// tgt.setSource(src.getSource()); -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } - - public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - -// public org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// tgt.setP(convertType(src.getP())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// tgt.setP(convertType(src.getP())); -// return tgt; -// } - - public org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addCategory(convertCodeableConcept(src.getClass_())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setDate(src.getCreated()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) - return ReferredDocumentStatus.PRELIMINARY; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) - return ReferredDocumentStatus.FINAL; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) - return ReferredDocumentStatus.AMENDED; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) - return ReferredDocumentStatus.ENTEREDINERROR; - - return null; - } - - private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { - CodeableConcept cc = new CodeableConcept (); - switch (docStatus) { - case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; - case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; - case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; - case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getDate()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - - public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) - tgt.setFormat(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - tgt.addFormat(convertCoding(src.getFormat())); - return tgt; - } - - public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.addEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounterFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.r4.model.Reference t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Reference tgt = convertReference(src.getRef()); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src)); - return tgt; - } - - - public org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.addAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; - case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; - case ARRIVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; - case FINISHED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; - } - } - - public org.hl7.fhir.r4.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPATIENT: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); - case OUTPATIENT: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); - case AMBULATORY: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); - case EMERGENCY: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); - case HOME: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); - case FIELD: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); - case DAYTIME: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); - case VIRTUAL: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); - default: return null; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.r4.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src.getSystem().equals("http://terminology.hl7.org/v3/ActCode")) { - if (src.getCode().equals("IMP")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; - if (src.getCode().equals("AMB")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; - if (src.getCode().equals("EMER")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; - if (src.getCode().equals("HH")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; - if (src.getCode().equals("FLD")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; - if (src.getCode().equals("")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; - if (src.getCode().equals("VR")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; - } - return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; - } - -// public org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - - public org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.EnrollmentRequest tgt = new org.hl7.fhir.r4.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); - tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setCandidate(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r4.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); -// tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); -// tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.r4.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.EnrollmentResponse tgt = new org.hl7.fhir.r4.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setRequest(convertReference(src.getRequest())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setRequestProvider(convertReference(src.getRequestProvider())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r4.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// tgt.setRequest(convertReference(src.getRequestReference())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); -// tgt.setOrganization(convertReference(src.getOrganizationReference())); -// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); - return tgt; - } - - public org.hl7.fhir.r4.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.EpisodeOfCare tgt = new org.hl7.fhir.r4.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r4.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - - public org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Flag tgt = new org.hl7.fhir.r4.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.r4.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.r4.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r4.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Group tgt = new org.hl7.fhir.r4.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.r4.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.r4.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.r4.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r4.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r4.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HealthcareService tgt = new org.hl7.fhir.r4.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { -// if (t.hasType()) -// tgt.addServiceType(convertCodeableConcept(t.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(tj)); - } - tgt.addLocation(convertReference(src.getLocation())); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility()) - tgt.getEligibilityFirstRep().setCode(convertCodeableConcept(src.getEligibility())); - if (src.hasEligibilityNote()) - tgt.getEligibilityFirstRep().setComment(src.getEligibilityNote()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) - tgt.addProgram().setText(t.getValue()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.r4.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) -// tgt.addServiceType().setType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) { - if (!tgt.hasServiceType()) - tgt.addServiceType(); - tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) - tgt.setLocation(convertReference(t)); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); - tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgram()) - if (t.hasText()) - tgt.addProgramName(t.getText()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - -// public org.hl7.fhir.r4.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu2.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ImagingObjectSelection tgt = new org.hl7.fhir.r4.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.r4.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r4.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.r4.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.r4.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.r4.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.r4.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.r4.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.r4.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) -// tgt.addFrame(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.r4.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) -// tgt.addFrames(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.r4.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.UnsignedIntType t : src.getFrameNumbers()) -// tgt.addNumber(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.r4.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getNumber()) -// tgt.addFrameNumbers(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// - - private org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) { - for (ImmunizationPerformerComponent p : practitioner) { - if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "AP")) - return p.getActor(); - } - return null; - } - - private org.hl7.fhir.r4.model.Reference getRequester(List practitioner) { - for (ImmunizationPerformerComponent p : practitioner) { - if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "OP")) - return p.getActor(); - } - return null; - } - - private boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - - public org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu2.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - } - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r4.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - if (id != null) - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (id.equals(t.getId())) - return t; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t.setName("Default Package"); - t.setId(id); - return t; - } - - public org.hl7.fhir.r4.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); - tgt.setUri(src.getUri()); - return tgt; - } - - - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) - tgt.setExample(convertReferenceToCanonical(src.getExampleFor())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) { - tgt.setName(convertUriToUrl(src.getSourceElement())); - } - tgt.setTitle(src.getName()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { - switch (kind) { - case PAGE: return GuidePageGeneration.HTML; - default: return GuidePageGeneration.GENERATED; - } - } - - - private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { - switch (generation) { - case HTML: return GuidePageKind.PAGE; - default: return GuidePageKind.RESOURCE; - } - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - tgt.setName(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - - public org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Location tgt = new org.hl7.fhir.r4.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.addType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.r4.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.r4.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.r4.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r4.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.r4.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r4.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r4.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } -// -// public org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.dstu2.model.Media src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Media tgt = new org.hl7.fhir.r4.model.Media(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setType(convertDigitalMediaType(src.getType())); -// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); -// tgt.setView(convertCodeableConcept(src.getView())); -// tgt.setSubject(convertReference(src.getSubject())); -// tgt.setOperator(convertReference(src.getOperator())); -// tgt.getDevice().setDisplay(src.getDeviceName()); -// tgt.setHeight(src.getHeight()); -// tgt.setWidth(src.getWidth()); -// tgt.setFrames(src.getFrames()); -// tgt.setDuration(src.getDuration()); -// tgt.setContent(convertAttachment(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.r4.model.Media src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Media tgt = new org.hl7.fhir.dstu2.model.Media(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setType(convertDigitalMediaType(src.getType())); -// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); -// tgt.setView(convertCodeableConcept(src.getView())); -// tgt.setSubject(convertReference(src.getSubject())); -// tgt.setOperator(convertReference(src.getOperator())); -// tgt.setDeviceName(src.getDevice().getDisplay()); -// tgt.setHeight(src.getHeight()); -// tgt.setWidth(src.getWidth()); -// tgt.setFrames(src.getFrames()); -// tgt.setDuration(src.getDuration()); -// tgt.setContent(convertAttachment(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Media.DigitalCategoryType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PHOTO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.PHOTO; -// case VIDEO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.VIDEO; -// case AUDIO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.AUDIO; -// default: return org.hl7.fhir.r4.model.Media.DigitalMediaType.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r4.model.Media.DigitalMediaType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PHOTO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; -// case VIDEO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; -// case AUDIO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; -// default: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; -// } -// } -// -// public org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.dstu2.model.Medication src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication tgt = new org.hl7.fhir.r4.model.Medication(); -// copyDomainResource(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// tgt.setIsBrand(src.getIsBrand()); -// tgt.setManufacturer(convertReference(src.getManufacturer())); -//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); -//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication convertMedication(org.hl7.fhir.r4.model.Medication src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication tgt = new org.hl7.fhir.dstu2.model.Medication(); -// copyDomainResource(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// tgt.setIsBrand(src.getIsBrand()); -// tgt.setManufacturer(convertReference(src.getManufacturer())); -//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); -//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.r4.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.r4.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.r4.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.r4.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.r4.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageComponent(); -// copyElement(src, tgt); -// tgt.setContainer(convertCodeableConcept(src.getContainer())); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent t : src.getContent()) -// tgt.addContent(convertMedicationPackageContentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent(); -// copyElement(src, tgt); -// tgt.setContainer(convertCodeableConcept(src.getContainer())); -// for (org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent t : src.getContent()) -// tgt.addContent(convertMedicationPackageContentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } - - public org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public String convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - return src.toCode(); - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { - if (src == null) - return null; - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); - } - - public org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - return tgt; - } - - public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - -// public org.hl7.fhir.r4.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.MedicationOrder tgt = new org.hl7.fhir.r4.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReasonCodeableConcept()) -// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); -// if (src.hasReasonReference()) -// tgt.addReasonReference(convertReference(src.getReasonReference())); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// if (src.hasNote()) -// tgt.addNote().setText(src.getNote()); -// for (org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.r4.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder tgt = new org.hl7.fhir.dstu2.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) -// tgt.setReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) -// tgt.setReason(convertReference(t)); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) -// tgt.setNote(t.getText()); -// for (org.hl7.fhir.r4.model.DosageInstruction t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } - - public org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - -// public org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.r4.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } - - public org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) - tgt.addDerivedFrom(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - if (src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); - copyDomainResource(src, tgt); -// tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); - copyDomainResource(src, tgt); -// tgt.setTimestamp(src.getTimestamp()); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) - tgt.addData(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.addNote().setText(src.getComments()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) - if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER) - tgt.addHasMember(convertReference(t.getTarget())); - else if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM) - tgt.addDerivedFrom(convertReference(t.getTarget())); for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory()) - tgt.setCategory(convertCodeableConcept(c)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - if (src.hasNote()) - tgt.setComments(src.getNoteFirstRep().getText()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getHasMember()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER)); - for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM)); - for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - tgt.setType(convertCodeableConcept(src.getMeaning())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); -// for (org.hl7.fhir.r4.model.CodeableConcept c : src.getMeaning()) - tgt.setMeaning(convertCodeableConcept(src.getType())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - - public org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Reference src, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType type) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(type); - tgt.setTarget(convertReference(src)); - return tgt; - } - - - public org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setComment(src.getNotes()); - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setIdempotent(!src.getAffectsState()); - tgt.setCode(src.getCode()); - tgt.setNotes(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { - tgt.setType("string"); - tgt.setSearchType(SearchParamType.fromCode(src.getType())); - } else { - tgt.setType(src.getType()); - } - tgt.addTargetProfile(src.getProfile().getReference()); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSearchType()) { - tgt.setType(src.getSearchType().toCode()); - } else - tgt.setType(src.getType()); - for (org.hl7.fhir.r4.model.UriType t: src.getTargetProfile()) - tgt.setProfile(new Reference(t.getValue())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - Type t = convertType(src.getValueSet()); - if (t != null) { - if (t instanceof org.hl7.fhir.r4.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; - } - } - - - public org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.addType(convertCodeableConcept(src.getType())); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - - public org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient tgt = new org.hl7.fhir.r4.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasAnimal()) - tgt.addExtension(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) - tgt.addGeneralPractitioner(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.r4.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r4.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) - tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); - for (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getGeneralPractitioner()) - tgt.addCareProvider(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r4.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Extension convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); - copyElement(src, tgt); - if (src.hasSpecies()) - tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); - if (src.hasBreed()) - tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); - if (src.hasGenderStatus()) - tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); - copyElement(src, tgt); - if (src.hasExtension("species")) - tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); - if (src.hasExtension("breed")) - tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); - if (src.hasExtension("genderStatus")) - tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.r4.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r4.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACE: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; - case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REPLACES: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REFER: return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; - } - } - - - public org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Person tgt = new org.hl7.fhir.r4.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.r4.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r4.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r4.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - if (src.hasName()) - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) -// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.setName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent t : src.getRole()) -// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - -// public org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setOrganization(convertReference(src.getManagingOrganization())); -// tgt.setCode(convertCodeableConcept(src.getRole())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setManagingOrganization(convertReference(src.getOrganization())); -// tgt.setRole(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - -// public org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.dstu2.model.Provenance src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Provenance tgt = new org.hl7.fhir.r4.model.Provenance(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getTarget()) -// tgt.addTarget(convertReference(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// tgt.setRecorded(src.getRecorded()); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) -// for (org.hl7.fhir.dstu2.model.Coding tc : t.getCoding()) -// tgt.addReason(convertCoding(tc)); -// for (org.hl7.fhir.dstu2.model.Coding t : src.getActivity().getCoding()) -// tgt.setActivity(convertCoding(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) -// tgt.addPolicy(t.getValue()); -// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.addAgent(convertProvenanceAgentComponent(t)); -// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) -// tgt.addEntity(convertProvenanceEntityComponent(t)); -// for (org.hl7.fhir.dstu2.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.r4.model.Provenance src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Reference t : src.getTarget()) -// tgt.addTarget(convertReference(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// tgt.setRecorded(src.getRecorded()); -// for (org.hl7.fhir.r4.model.Coding t : src.getReason()) -// tgt.addReason().addCoding(convertCoding(t)); -// tgt.setActivity(new org.hl7.fhir.dstu2.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); -// tgt.setLocation(convertReference(src.getLocation())); -// for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) -// tgt.addPolicy(t.getValue()); -// for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.addAgent(convertProvenanceAgentComponent(t)); -// for (org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) -// tgt.addEntity(convertProvenanceEntityComponent(t)); -// for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent(); -// copyElement(src, tgt); -//// tgt.setRole(convertCoding(src.getRole())); -// tgt.setWho(convertReference(src.getActor())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent(); -// copyElement(src, tgt); -//// tgt.setRole(convertCoding(src.getRole())); -// if (src.hasWhoReference()) -// tgt.setActor(convertReference(src.getWhoReference())); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertProvenanceEntityRole(src.getRole())); -// if (src.hasReference()) -// tgt.setWhat(new org.hl7.fhir.r4.model.Reference().setReference(src.getReference())); -// tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertProvenanceEntityRole(src.getRole())); -// if (src.hasWhatReference() && src.getWhatReference().hasReference()) -// tgt.setReference(src.getWhatReference().getReference()); -// for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.setAgent(convertProvenanceAgentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DERIVATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.DERIVATION; -// case REVISION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REVISION; -// case QUOTATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.QUOTATION; -// case SOURCE: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.SOURCE; -// default: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DERIVATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; -// case REVISION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; -// case QUOTATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; -// case SOURCE: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; -// default: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; -// } -// } - - public org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); - tgt.setTitle(root.getTitle()); - for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - tgt.addItem(convertQuestionnaireGroupComponent(root)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); - root.setTitle(src.getTitle()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) { - root.addConcept(convertCoding(t)); - } - for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP) - root.addGroup(convertQuestionnaireGroupComponent(t)); - else - root.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireQuestionType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) - tgt.addAnswerOption().setValue(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - else - tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - if (t.hasValueCoding()) - try { - tgt.addOption(convertCoding(t.getValueCoding())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); + public static org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; } - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; } - } - public org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; - case DATE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; - case DATETIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; - case TIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; - case STRING: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; - case TEXT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; - case URL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; - case CHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; - default: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - - if (src.getItem().size() != 1) - throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? - - tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); - return tgt; - } - - - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; } - } - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - if (t.hasAnswer()) - tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); - else - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - - public org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDate(src.getDate()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDateElement(src.getOccurrenceDateTimeType()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addServiceType(convertCodeableConcept(t)); - tgt.addActor(convertReference(src.getActor())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActorFirstRep())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; } - } - public org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) { - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + public static org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; } - if (src.hasConstrainedType()) - tgt.setType(src.getConstrainedType()); - else if (src.getSnapshot().hasElement()) - tgt.setType(src.getSnapshot().getElement().get(0).getPath()); - else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) - tgt.setType(src.getDifferential().getElement().get(0).getPath()); - else - tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); - tgt.setBaseDefinition(src.getBase()); - tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElementFirstRep().getType().clear(); - if (tgt.hasDifferential()) - tgt.getDifferential().getElementFirstRep().getType().clear(); - - - if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); -// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } -// for (ElementDefinition ed : tgt.getDifferential().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } - tgt.setType(tgt.getId()); + + public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; } - if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { - for (ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + + public static org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; } - } } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + public static org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; + } } - tgt.setConstrainedType(src.getType()); - tgt.setBase(src.getBaseDefinition()); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasBase()) { - if (tgt.hasDifferential()) - tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + + public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; } - return tgt; - } - private String tail(String base) { - return base.substring(base.lastIndexOf("/")+1); - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; } - } - private static org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + public static org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; } - } - private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource102(tn)) { - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; + } } - } - private static boolean isResource102(String tn) { - return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression", - "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent", - "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", - "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection", - "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", - "MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization", - "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire", - "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance", - "SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription"); - } - - public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + public static org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; + } } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; + public static org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; } - } - public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - tgt.addHeader(src.getHeader()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - if (src.hasHeader()) - tgt.setHeaderElement(convertString(src.getHeader().get(0))); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; + public static org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; } - } - public org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); - tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); -// tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; } - } - public org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest(); - copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); -// for (org.hl7.fhir.r4.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case FAILED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL; + public static org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getConformance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.r4.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertCanonicalToReference(src.getCapabilitiesElement())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return "application/fhir+xml"; - case JSON: return "application/fhir+json"; - default: return null; - } -} - - private static org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException { - if (src == null) - return null; - if (src.contains("xml")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; - if (src.contains("json")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; - return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; - } - - - public org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; - } - } - - - public org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setCaseSensitive(src.getCaseSensitive()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(src, cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); - tgt.setCode(src.getCode()); - tgt.setDefinition(src.getDefinition()); - tgt.setDisplay(src.getDisplay()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(cs, cc)); - for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) - tgt.addDesignation(convertCodeSystemDesignation(cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setUse(convertCoding(src.getUse())); - tgt.setLanguage(src.getLanguage()); - tgt.setValue(src.getValue()); - - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - if (src.hasCompose()) { - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - tgt.getCompose().setLockedDate(src.getLockedDate()); - } - if (src.hasCodeSystem() && advisor != null) { - org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem(); - copyDomainResource(src, tgtcs); - tgtcs.setUrl(src.getCodeSystem().getSystem()); - tgtcs.addIdentifier(convertIdentifier(src.getIdentifier())); - tgtcs.setVersion(src.getCodeSystem().getVersion()); - tgtcs.setName(src.getName()+" Code System"); - tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgtcs.setExperimental(src.getExperimental()); - tgtcs.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgtcs.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgtcs.setDate(src.getDate()); - tgtcs.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgtcs.addJurisdiction(convertCodeableConcept(t)); + public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); else - tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); - tgtcs.setPurpose(src.getRequirements()); - tgtcs.setCopyright(src.getCopyright()); - tgtcs.setContent(CodeSystemContentMode.COMPLETE); - tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) - processConcept(tgtcs.getConcept(), cs, tgtcs); - advisor.handleCodeSystem(tgtcs, tgt); - tgt.setUserData("r2-cs", tgtcs); - tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); - } - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - private void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (cs.getAbstract()) - CodeSystemUtilities.setNotSelectable(tgtcs, ct); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + tgt.setWho(convertReference(src.getWhoReference())); + tgt.setSigFormat(src.getContentType()); + tgt.setData(src.getBlob()); + return tgt; } - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, tgtcs); - } - - private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) - ct.setAbstract(true); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + public static org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getSigFormat()); + tgt.setBlob(src.getData()); + return tgt; } - for (ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, srcCS); - } - - public org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(i)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setLockedDate(src.getCompose().getLockedDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) - tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); - org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); - if (srcCS == null) - srcCS = advisor.getCodeSystem(src); - if (srcCS != null) { - tgt.getCodeSystem().setSystem(srcCS.getUrl()); - tgt.getCodeSystem().setVersion(srcCS.getVersion()); - tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) - processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); - + public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - - public org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - if (noSystem == null || !t.getSystem().equals(noSystem)) - tgt.addInclude(convertConceptSetComponent(t)); + public static org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - public org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r4.model.Address.AddressUse.NULL; + } } - } - public org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; + } } - } - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - if (src.hasNote()) - tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote())); - for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; + public static org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r4.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r4.model.Address.AddressType.NULL; + } } - } - public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; + public static org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; + } } - } - public org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; - default: return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + public static org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - - - public org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu2.model.Basic) - return convertBasic((org.hl7.fhir.dstu2.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu2.model.Binary) - return convertBinary((org.hl7.fhir.dstu2.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu2.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); -// if (src instanceof org.hl7.fhir.dstu2.model.ClinicalImpression) -// return convertClinicalImpression((org.hl7.fhir.dstu2.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu2.model.Communication) - return convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.Composition) - return convertComposition((org.hl7.fhir.dstu2.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2.model.Condition) - return convertCondition((org.hl7.fhir.dstu2.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu2.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Contract) -// return convertContract((org.hl7.fhir.dstu2.model.Contract) src); - if (src instanceof org.hl7.fhir.dstu2.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Device) -// return convertDevice((org.hl7.fhir.dstu2.model.Device) src); -// if (src instanceof org.hl7.fhir.dstu2.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.dstu2.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.dstu2.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.dstu2.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu2.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu2.model.Flag) - return convertFlag((org.hl7.fhir.dstu2.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu2.model.Group) - return convertGroup((org.hl7.fhir.dstu2.model.Group) src); - if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2.model.List_) - return convertList((org.hl7.fhir.dstu2.model.List_) src); - if (src instanceof org.hl7.fhir.dstu2.model.Location) - return convertLocation((org.hl7.fhir.dstu2.model.Location) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Media) -// return convertMedia((org.hl7.fhir.dstu2.model.Media) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Medication) -// return convertMedication((org.hl7.fhir.dstu2.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.dstu2.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.dstu2.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2.model.Observation) - return convertObservation((org.hl7.fhir.dstu2.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2.model.Organization) - return convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu2.model.Patient) - return convertPatient((org.hl7.fhir.dstu2.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu2.model.Person) - return convertPerson((org.hl7.fhir.dstu2.model.Person) src); - if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Provenance) -// return convertProvenance((org.hl7.fhir.dstu2.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu2.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2.model.Slot) - return convertSlot((org.hl7.fhir.dstu2.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2.model.Subscription) - return convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu2.model.Substance) - return convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r4.model.Parameters) - return convertParameters((org.hl7.fhir.r4.model.Parameters) src); - if (src instanceof org.hl7.fhir.r4.model.Appointment) - return convertAppointment((org.hl7.fhir.r4.model.Appointment) src); - if (src instanceof org.hl7.fhir.r4.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.r4.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.r4.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.r4.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.r4.model.Basic) - return convertBasic((org.hl7.fhir.r4.model.Basic) src); - if (src instanceof org.hl7.fhir.r4.model.Binary) - return convertBinary((org.hl7.fhir.r4.model.Binary) src); - if (src instanceof org.hl7.fhir.r4.model.Bundle) - return convertBundle((org.hl7.fhir.r4.model.Bundle) src); - if (src instanceof org.hl7.fhir.r4.model.CarePlan) - return convertCarePlan((org.hl7.fhir.r4.model.CarePlan) src); -// if (src instanceof org.hl7.fhir.r4.model.ClinicalImpression) -// return convertClinicalImpression((org.hl7.fhir.r4.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.r4.model.Communication) - return convertCommunication((org.hl7.fhir.r4.model.Communication) src); - if (src instanceof org.hl7.fhir.r4.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.r4.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.r4.model.Composition) - return convertComposition((org.hl7.fhir.r4.model.Composition) src); - if (src instanceof org.hl7.fhir.r4.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r4.model.Condition) - return convertCondition((org.hl7.fhir.r4.model.Condition) src); - if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src); -// if (src instanceof org.hl7.fhir.r4.model.Contract) -// return convertContract((org.hl7.fhir.r4.model.Contract) src); - if (src instanceof org.hl7.fhir.r4.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.r4.model.Device) -// return convertDevice((org.hl7.fhir.r4.model.Device) src); -// if (src instanceof org.hl7.fhir.r4.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.r4.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.r4.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.r4.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.r4.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.r4.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.r4.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.r4.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.r4.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.r4.model.Encounter) - return convertEncounter((org.hl7.fhir.r4.model.Encounter) src); - if (src instanceof org.hl7.fhir.r4.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.r4.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.r4.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.r4.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.r4.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.r4.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.r4.model.Flag) - return convertFlag((org.hl7.fhir.r4.model.Flag) src); - if (src instanceof org.hl7.fhir.r4.model.Group) - return convertGroup((org.hl7.fhir.r4.model.Group) src); - if (src instanceof org.hl7.fhir.r4.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.r4.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r4.model.ListResource) - return convertList((org.hl7.fhir.r4.model.ListResource) src); - if (src instanceof org.hl7.fhir.r4.model.Location) - return convertLocation((org.hl7.fhir.r4.model.Location) src); -// if (src instanceof org.hl7.fhir.r4.model.Media) -// return convertMedia((org.hl7.fhir.r4.model.Media) src); -// if (src instanceof org.hl7.fhir.r4.model.Medication) -// return convertMedication((org.hl7.fhir.r4.model.Medication) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.r4.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.r4.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.r4.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.r4.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.r4.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.r4.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.r4.model.Observation) - return convertObservation((org.hl7.fhir.r4.model.Observation) src); - if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r4.model.Organization) - return convertOrganization((org.hl7.fhir.r4.model.Organization) src); - if (src instanceof org.hl7.fhir.r4.model.Patient) - return convertPatient((org.hl7.fhir.r4.model.Patient) src); - if (src instanceof org.hl7.fhir.r4.model.Person) - return convertPerson((org.hl7.fhir.r4.model.Person) src); - if (src instanceof org.hl7.fhir.r4.model.Practitioner) - return convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src); -// if (src instanceof org.hl7.fhir.r4.model.Provenance) -// return convertProvenance((org.hl7.fhir.r4.model.Provenance) src); - if (src instanceof org.hl7.fhir.r4.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r4.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.r4.model.Schedule) - return convertSchedule((org.hl7.fhir.r4.model.Schedule) src); - if (src instanceof org.hl7.fhir.r4.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r4.model.Slot) - return convertSlot((org.hl7.fhir.r4.model.Slot) src); - if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.Subscription) - return convertSubscription((org.hl7.fhir.r4.model.Subscription) src); - if (src instanceof org.hl7.fhir.r4.model.Substance) - return convertSubstance((org.hl7.fhir.r4.model.Substance) src); - if (src instanceof org.hl7.fhir.r4.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.r4.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.r4.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.r4.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.r4.model.TestScript) - return convertTestScript((org.hl7.fhir.r4.model.TestScript) src); - if (src instanceof org.hl7.fhir.r4.model.ValueSet) - return convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public TerminologyCapabilities convertTerminologyCapabilities(Parameters src) { - TerminologyCapabilities res = new TerminologyCapabilities(); - for (ParametersParameterComponent p : src.getParameter()) { - if (p.getName().equals("system")) - res.addCodeSystem().setUri(p.getValue().primitiveValue()); + public static org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; + } } - return res; - } - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", - "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", - "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", - "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); - } + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + case URL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; + } + } + public static org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#" + src.getNameReference()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) convertElementDefinitionTypeComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + if (!tgt.hasId()) + tgt.setId(tgt.getPath()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + else + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) convertElementDefinitionTypeComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices == 2 && existsSlicePresent && notExistsSlicePresent) || (slices == 1 && existsSlicePresent != notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static void convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) tgt.addTargetProfile(u.getValue()); + } else { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregationElement().setValue(a)); + } + } + + public static void convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.r4.model.Type vs = convertType(src.getValueSet()); + if (vs != null) { + tgt.setValueSet(vs instanceof org.hl7.fhir.r4.model.Reference ? ((org.hl7.fhir.r4.model.Reference) vs).getReference() : vs.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.r4.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r4.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r4.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r4.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r4.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r4.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r4.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeType) + return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateType) + return convertDate((org.hl7.fhir.dstu2.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IdType) + return convertId((org.hl7.fhir.dstu2.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2.model.OidType) + return convertOid((org.hl7.fhir.dstu2.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.StringType) + return convertString((org.hl7.fhir.dstu2.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2.model.TimeType) + return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UriType) + return convertUri((org.hl7.fhir.dstu2.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.Extension) + return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2.model.Coding) + return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2.model.Period) + return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2.model.Range) + return convertRange((org.hl7.fhir.dstu2.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2.model.Reference) + return convertReference((org.hl7.fhir.dstu2.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2.model.Signature) + return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2.model.Address) + return convertAddress((org.hl7.fhir.dstu2.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2.model.Meta) + return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2.model.Timing) + return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu2.model.Age) + return convertAge((org.hl7.fhir.dstu2.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2.model.Count) + return convertCount((org.hl7.fhir.dstu2.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2.model.Distance) + return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Duration) + return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2.model.Money) + return convertMoney((org.hl7.fhir.dstu2.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r4.model.BooleanType) + return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r4.model.CodeType) + return convertCode((org.hl7.fhir.r4.model.CodeType) src); + if (src instanceof org.hl7.fhir.r4.model.DateType) + return convertDate((org.hl7.fhir.r4.model.DateType) src); + if (src instanceof org.hl7.fhir.r4.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r4.model.DecimalType) + return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r4.model.IdType) + return convertId((org.hl7.fhir.r4.model.IdType) src); + if (src instanceof org.hl7.fhir.r4.model.InstantType) + return convertInstant((org.hl7.fhir.r4.model.InstantType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r4.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r4.model.OidType) + return convertOid((org.hl7.fhir.r4.model.OidType) src); + if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return convertString((org.hl7.fhir.r4.model.StringType) src); + if (src instanceof org.hl7.fhir.r4.model.TimeType) + return convertTime((org.hl7.fhir.r4.model.TimeType) src); + if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) + return convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.UuidType) + return convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.Extension) + return convertExtension((org.hl7.fhir.r4.model.Extension) src); + if (src instanceof org.hl7.fhir.r4.model.Narrative) + return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); + if (src instanceof org.hl7.fhir.r4.model.Annotation) + return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); + if (src instanceof org.hl7.fhir.r4.model.Attachment) + return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); + if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r4.model.Coding) + return convertCoding((org.hl7.fhir.r4.model.Coding) src); + if (src instanceof org.hl7.fhir.r4.model.Identifier) + return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); + if (src instanceof org.hl7.fhir.r4.model.Period) + return convertPeriod((org.hl7.fhir.r4.model.Period) src); + if (src instanceof org.hl7.fhir.r4.model.Quantity) + return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); + if (src instanceof org.hl7.fhir.r4.model.Range) + return convertRange((org.hl7.fhir.r4.model.Range) src); + if (src instanceof org.hl7.fhir.r4.model.Ratio) + return convertRatio((org.hl7.fhir.r4.model.Ratio) src); + if (src instanceof org.hl7.fhir.r4.model.Reference) + return convertReference((org.hl7.fhir.r4.model.Reference) src); + if (src instanceof org.hl7.fhir.r4.model.SampledData) + return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); + if (src instanceof org.hl7.fhir.r4.model.Signature) + return convertSignature((org.hl7.fhir.r4.model.Signature) src); + if (src instanceof org.hl7.fhir.r4.model.Address) + return convertAddress((org.hl7.fhir.r4.model.Address) src); + if (src instanceof org.hl7.fhir.r4.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r4.model.HumanName) + return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); + if (src instanceof org.hl7.fhir.r4.model.Meta) + return convertMeta((org.hl7.fhir.r4.model.Meta) src); + if (src instanceof org.hl7.fhir.r4.model.Timing) + return convertTiming((org.hl7.fhir.r4.model.Timing) src); + if (src instanceof org.hl7.fhir.r4.model.Age) + return convertAge((org.hl7.fhir.r4.model.Age) src); + if (src instanceof org.hl7.fhir.r4.model.Count) + return convertCount((org.hl7.fhir.r4.model.Count) src); + if (src instanceof org.hl7.fhir.r4.model.Distance) + return convertDistance((org.hl7.fhir.r4.model.Distance) src); + if (src instanceof org.hl7.fhir.r4.model.Duration) + return convertDuration((org.hl7.fhir.r4.model.Duration) src); + if (src instanceof org.hl7.fhir.r4.model.Money) + return convertMoney((org.hl7.fhir.r4.model.Money) src); + if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(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()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r4.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + + public static void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; + } + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; + } + + public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + public static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + static public org.hl7.fhir.r4.model.Reference getRequester(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } + + static public boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + static public boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + public static org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: + return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: + return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + return tgt; + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Parameters) + return Parameters10_40.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2.model.Appointment) + return Appointment10_40.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) + return AppointmentResponse10_40.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) + return AuditEvent10_40.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu2.model.Basic) + return Basic10_40.convertBasic((org.hl7.fhir.dstu2.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu2.model.Binary) + return Binary10_40.convertBinary((org.hl7.fhir.dstu2.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu2.model.Bundle) + return Bundle10_40.convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) + return CarePlan10_40.convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu2.model.Communication) + return Communication10_40.convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) + return CommunicationRequest10_40.convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.Composition) + return Composition10_40.convertComposition((org.hl7.fhir.dstu2.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) + return ConceptMap10_40.convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2.model.Condition) + return Condition10_40.convertCondition((org.hl7.fhir.dstu2.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Conformance) + return Conformance10_40.convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2.model.DataElement) + return DataElement10_40.convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) + return DetectedIssue10_40.convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) + return DeviceMetric10_40.convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) + return DeviceUseStatement10_40.convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) + return DiagnosticReport10_40.convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) + return DocumentReference10_40.convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu2.model.Encounter) + return Encounter10_40.convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) + return EnrollmentRequest10_40.convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) + return EnrollmentResponse10_40.convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) + return EpisodeOfCare10_40.convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) + return FamilyMemberHistory10_40.convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu2.model.Flag) + return Flag10_40.convertFlag((org.hl7.fhir.dstu2.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu2.model.Group) + return Group10_40.convertGroup((org.hl7.fhir.dstu2.model.Group) src); + if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) + return HealthcareService10_40.convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) + return ImplementationGuide10_40.convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2.model.List_) + return List10_40.convertList((org.hl7.fhir.dstu2.model.List_) src); + if (src instanceof org.hl7.fhir.dstu2.model.Location) + return Location10_40.convertLocation((org.hl7.fhir.dstu2.model.Location) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) + return MedicationDispense10_40.convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) + return MedicationStatement10_40.convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) + return MessageHeader10_40.convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) + return NamingSystem10_40.convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2.model.Observation) + return Observation10_40.convertObservation((org.hl7.fhir.dstu2.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) + return OperationDefinition10_40.convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) + return OperationOutcome10_40.convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2.model.Organization) + return Organization10_40.convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu2.model.Patient) + return Patient10_40.convertPatient((org.hl7.fhir.dstu2.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu2.model.Person) + return Person10_40.convertPerson((org.hl7.fhir.dstu2.model.Person) src); + if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) + return Practitioner10_40.convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) + return Questionnaire10_40.convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) + return QuestionnaireResponse10_40.convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) + return RiskAssessment10_40.convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu2.model.Schedule) + return Schedule10_40.convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) + return SearchParameter10_40.convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2.model.Slot) + return Slot10_40.convertSlot((org.hl7.fhir.dstu2.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) + return StructureDefinition10_40.convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Subscription) + return Subscription10_40.convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu2.model.Substance) + return Substance10_40.convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) + return SupplyDelivery10_40.convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) + return SupplyRequest10_40.convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.TestScript) + return TestScript10_40.convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) + return ValueSet10_40.convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r4.model.Parameters) + return Parameters10_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src); + if (src instanceof org.hl7.fhir.r4.model.Appointment) + return Appointment10_40.convertAppointment((org.hl7.fhir.r4.model.Appointment) src); + if (src instanceof org.hl7.fhir.r4.model.AppointmentResponse) + return AppointmentResponse10_40.convertAppointmentResponse((org.hl7.fhir.r4.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r4.model.AuditEvent) + return AuditEvent10_40.convertAuditEvent((org.hl7.fhir.r4.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r4.model.Basic) + return Basic10_40.convertBasic((org.hl7.fhir.r4.model.Basic) src); + if (src instanceof org.hl7.fhir.r4.model.Binary) + return Binary10_40.convertBinary((org.hl7.fhir.r4.model.Binary) src); + if (src instanceof org.hl7.fhir.r4.model.Bundle) + return Bundle10_40.convertBundle((org.hl7.fhir.r4.model.Bundle) src, advisor); + if (src instanceof org.hl7.fhir.r4.model.CarePlan) + return CarePlan10_40.convertCarePlan((org.hl7.fhir.r4.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r4.model.Communication) + return Communication10_40.convertCommunication((org.hl7.fhir.r4.model.Communication) src); + if (src instanceof org.hl7.fhir.r4.model.CommunicationRequest) + return CommunicationRequest10_40.convertCommunicationRequest((org.hl7.fhir.r4.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.r4.model.Composition) + return Composition10_40.convertComposition((org.hl7.fhir.r4.model.Composition) src); + if (src instanceof org.hl7.fhir.r4.model.ConceptMap) + return ConceptMap10_40.convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r4.model.Condition) + return Condition10_40.convertCondition((org.hl7.fhir.r4.model.Condition) src); + if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) + return Conformance10_40.convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r4.model.DetectedIssue) + return DetectedIssue10_40.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceMetric) + return DeviceMetric10_40.convertDeviceMetric((org.hl7.fhir.r4.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement) + return DeviceUseStatement10_40.convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport) + return DiagnosticReport10_40.convertDiagnosticReport((org.hl7.fhir.r4.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r4.model.DocumentReference) + return DocumentReference10_40.convertDocumentReference((org.hl7.fhir.r4.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r4.model.Encounter) + return Encounter10_40.convertEncounter((org.hl7.fhir.r4.model.Encounter) src); + if (src instanceof org.hl7.fhir.r4.model.EnrollmentRequest) + return EnrollmentRequest10_40.convertEnrollmentRequest((org.hl7.fhir.r4.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.r4.model.EnrollmentResponse) + return EnrollmentResponse10_40.convertEnrollmentResponse((org.hl7.fhir.r4.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare) + return EpisodeOfCare10_40.convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r4.model.FamilyMemberHistory) + return FamilyMemberHistory10_40.convertFamilyMemberHistory((org.hl7.fhir.r4.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r4.model.Flag) + return Flag10_40.convertFlag((org.hl7.fhir.r4.model.Flag) src); + if (src instanceof org.hl7.fhir.r4.model.Group) + return Group10_40.convertGroup((org.hl7.fhir.r4.model.Group) src); + if (src instanceof org.hl7.fhir.r4.model.HealthcareService) + return HealthcareService10_40.convertHealthcareService((org.hl7.fhir.r4.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) + return ImplementationGuide10_40.convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r4.model.ListResource) + return List10_40.convertList((org.hl7.fhir.r4.model.ListResource) src); + if (src instanceof org.hl7.fhir.r4.model.Location) + return Location10_40.convertLocation((org.hl7.fhir.r4.model.Location) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationDispense) + return MedicationDispense10_40.convertMedicationDispense((org.hl7.fhir.r4.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationStatement) + return MedicationStatement10_40.convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r4.model.MessageHeader) + return MessageHeader10_40.convertMessageHeader((org.hl7.fhir.r4.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r4.model.NamingSystem) + return NamingSystem10_40.convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r4.model.Observation) + return Observation10_40.convertObservation((org.hl7.fhir.r4.model.Observation) src); + if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) + return OperationDefinition10_40.convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) + return OperationOutcome10_40.convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r4.model.Organization) + return Organization10_40.convertOrganization((org.hl7.fhir.r4.model.Organization) src); + if (src instanceof org.hl7.fhir.r4.model.Patient) + return Patient10_40.convertPatient((org.hl7.fhir.r4.model.Patient) src); + if (src instanceof org.hl7.fhir.r4.model.Person) + return Person10_40.convertPerson((org.hl7.fhir.r4.model.Person) src); + if (src instanceof org.hl7.fhir.r4.model.Practitioner) + return Practitioner10_40.convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r4.model.Questionnaire) + return Questionnaire10_40.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) + return QuestionnaireResponse10_40.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r4.model.RiskAssessment) + return RiskAssessment10_40.convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r4.model.Schedule) + return Schedule10_40.convertSchedule((org.hl7.fhir.r4.model.Schedule) src); + if (src instanceof org.hl7.fhir.r4.model.SearchParameter) + return SearchParameter10_40.convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r4.model.Slot) + return Slot10_40.convertSlot((org.hl7.fhir.r4.model.Slot) src); + if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) + return StructureDefinition10_40.convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Subscription) + return Subscription10_40.convertSubscription((org.hl7.fhir.r4.model.Subscription) src); + if (src instanceof org.hl7.fhir.r4.model.Substance) + return Substance10_40.convertSubstance((org.hl7.fhir.r4.model.Substance) src); + if (src instanceof org.hl7.fhir.r4.model.SupplyDelivery) + return SupplyDelivery10_40.convertSupplyDelivery((org.hl7.fhir.r4.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r4.model.SupplyRequest) + return SupplyRequest10_40.convertSupplyRequest((org.hl7.fhir.r4.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.r4.model.TestScript) + return TestScript10_40.convertTestScript((org.hl7.fhir.r4.model.TestScript) src); + if (src instanceof org.hl7.fhir.r4.model.ValueSet) + return ValueSet10_40.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); + } + return res; + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); + } + + public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { + return convertResource(src, null); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { + return convertResource(src, null); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java index 531424689..2141c3991 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java @@ -20,55 +20,28 @@ package org.hl7.fhir.convertors; * #L% */ - -import java.util.ArrayList; -import java.util.List; - +import org.hl7.fhir.convertors.conv10_50.*; import org.hl7.fhir.dstu2.model.CodeableConcept; -import org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind; import org.hl7.fhir.dstu2.model.Parameters; import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent; import org.hl7.fhir.dstu2.model.Reference; import org.hl7.fhir.dstu2.utils.ToolingExtensions; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.conformance.ProfileUtilities; -import org.hl7.fhir.r5.model.Annotation; -import org.hl7.fhir.r5.model.BooleanType; -import org.hl7.fhir.r5.model.CanonicalType; -import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; -import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; -import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction; -import org.hl7.fhir.r5.model.CodeSystem; -import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent; -import org.hl7.fhir.r5.model.CodeType; -import org.hl7.fhir.r5.model.CodeableReference; -import org.hl7.fhir.r5.model.ConceptMap; -import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.r5.model.ContactDetail; -import org.hl7.fhir.r5.model.Dosage; import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent; -import org.hl7.fhir.r5.model.ElementDefinition; import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.r5.model.Enumeration; -import org.hl7.fhir.r5.model.Enumerations; -import org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes; -import org.hl7.fhir.r5.model.Enumerations.ResourceTypeEnum; -import org.hl7.fhir.r5.model.Enumerations.SearchParamType; import org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent; -import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; -import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; -import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.r5.model.TerminologyCapabilities; -import org.hl7.fhir.r5.model.TestScript; import org.hl7.fhir.r5.model.Timing.EventTiming; -import org.hl7.fhir.r5.model.DataType; import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; import org.hl7.fhir.utilities.Utilities; +import java.util.ArrayList; +import java.util.List; + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -97,12303 +70,2692 @@ import org.hl7.fhir.utilities.Utilities; POSSIBILITY OF SUCH DAMAGE. */ - -// Generated on Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 - - public class VersionConvertor_10_50 { - private static List CANONICAL_URLS = new ArrayList(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } + static public List CANONICAL_URLS = new ArrayList(); - public VersionConvertorAdvisor50 advisor; - - public VersionConvertor_10_50(VersionConvertorAdvisor50 advisor) { - super(); - this.advisor = advisor; - } - - public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyElement(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + public static void copyElement(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } } - } - public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { - org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { - org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { - org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } - public org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { - org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } - public org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2.model.Reference) - tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); - else + public static org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + return tgt; } - } - public org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - public org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(Long.valueOf(src.getSize())); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(Math.toIntExact(src.getSize())); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - - - public org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + public static org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - tgt.setSigFormat(src.getContentType()); - tgt.setData(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getSigFormat()); - tgt.setBlob(src.getData()); - return tgt; - } - - public org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.r5.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) { - tgt.setRank(src.getRank()); - } - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) { - tgt.setRank(src.getRank()); - } - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - case URL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceName(src.getName()); - tgt.setId(src.getName()); - } - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasNameReference()) - tgt.setContentReference("#"+src.getNameReference()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertElementDefinitionTypeComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu2.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - if (!tgt.hasId()) - tgt.setId(tgt.getPath()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - else - tgt.setName(src.getId()); - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - tgt.setShort(src.getShort()); - tgt.setDefinition(src.getDefinition()); - tgt.setComments(src.getComment()); - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setNameReference(src.getContentReference().substring(1)); - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertElementDefinitionTypeComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - tgt.setMustSupport(src.getMustSupport()); - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - org.hl7.fhir.dstu2.model.ElementDefinition slicingElement = context.get(pos); - for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) { - boolean isExists = false; - if (!t.asStringValue().contains("@")) { - int slices = 0; - boolean existsSlicePresent = false; - boolean notExistsSlicePresent = false; - String existsPath = slicingElement.getPath() + "." + t.asStringValue(); - for (int i = pos + 1; i < context.size(); i++) { - org.hl7.fhir.dstu2.model.ElementDefinition e = context.get(i); - if (e.getPath().equals(slicingElement.getPath())) - slices++; - else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) - break; - else if (e.getPath().equals(existsPath)) { - if (e.hasMin() && e.getMin() > 0) - existsSlicePresent = true; - else if (e.hasMax() && e.getMax().equals("0")) - notExistsSlicePresent = true; - } + public static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; } - isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); - } - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); } - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public void convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - } - if (tgt.hasTarget()) { - for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) - tgt.addTargetProfile(u.getValue()); - } else { - for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) - tgt.addProfile(u.getValue()); - } - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); - } - } - - public void convertElementDefinitionTypeComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - list.add(tgt); - if (src.hasTarget()) { - for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { - tgt.addProfile(u.getValue()); - } - } else { - for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { - tgt.addProfile(u.getValue()); - } - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.r5.model.DataType vs = convertType(src.getValueSet()); - if (vs != null) { - tgt.setValueSet(vs instanceof org.hl7.fhir.r5.model.Reference ? ((org.hl7.fhir.r5.model.Reference) vs).getReference() : vs.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r5.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); - tgt.addWhen(convertEventTiming(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - return tgt; - } - - public org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setCurrency(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setCode(src.getCurrency()); - return tgt; - } - - public org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeType) - return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateType) - return convertDate((org.hl7.fhir.dstu2.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IdType) - return convertId((org.hl7.fhir.dstu2.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2.model.OidType) - return convertOid((org.hl7.fhir.dstu2.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.StringType) - return convertString((org.hl7.fhir.dstu2.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2.model.TimeType) - return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UriType) - return convertUri((org.hl7.fhir.dstu2.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2.model.Extension) - return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2.model.Coding) - return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2.model.Period) - return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2.model.Range) - return convertRange((org.hl7.fhir.dstu2.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2.model.Reference) - return convertReference((org.hl7.fhir.dstu2.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2.model.Signature) - return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2.model.Address) - return convertAddress((org.hl7.fhir.dstu2.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2.model.Meta) - return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2.model.Timing) - return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu2.model.Age) - return convertAge((org.hl7.fhir.dstu2.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2.model.Count) - return convertCount((org.hl7.fhir.dstu2.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2.model.Distance) - return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Duration) - return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2.model.Money) - return convertMoney((org.hl7.fhir.dstu2.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r5.model.BooleanType) - return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r5.model.CodeType) - return convertCode((org.hl7.fhir.r5.model.CodeType) src); - if (src instanceof org.hl7.fhir.r5.model.DateType) - return convertDate((org.hl7.fhir.r5.model.DateType) src); - if (src instanceof org.hl7.fhir.r5.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r5.model.DecimalType) - return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r5.model.IdType) - return convertId((org.hl7.fhir.r5.model.IdType) src); - if (src instanceof org.hl7.fhir.r5.model.InstantType) - return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r5.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r5.model.OidType) - return convertOid((org.hl7.fhir.r5.model.OidType) src); - if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r5.model.StringType) - return convertString((org.hl7.fhir.r5.model.StringType) src); - if (src instanceof org.hl7.fhir.r5.model.TimeType) - return convertTime((org.hl7.fhir.r5.model.TimeType) src); - if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r5.model.UriType) - return convertUri((org.hl7.fhir.r5.model.UriType) src); - if (src instanceof org.hl7.fhir.r5.model.UuidType) - return convertUuid((org.hl7.fhir.r5.model.UuidType) src); - if (src instanceof org.hl7.fhir.r5.model.Extension) - return convertExtension((org.hl7.fhir.r5.model.Extension) src); - if (src instanceof org.hl7.fhir.r5.model.Narrative) - return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); - if (src instanceof org.hl7.fhir.r5.model.Annotation) - return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); - if (src instanceof org.hl7.fhir.r5.model.Attachment) - return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); - if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r5.model.Coding) - return convertCoding((org.hl7.fhir.r5.model.Coding) src); - if (src instanceof org.hl7.fhir.r5.model.Identifier) - return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); - if (src instanceof org.hl7.fhir.r5.model.Period) - return convertPeriod((org.hl7.fhir.r5.model.Period) src); - if (src instanceof org.hl7.fhir.r5.model.Quantity) - return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); - if (src instanceof org.hl7.fhir.r5.model.Range) - return convertRange((org.hl7.fhir.r5.model.Range) src); - if (src instanceof org.hl7.fhir.r5.model.Ratio) - return convertRatio((org.hl7.fhir.r5.model.Ratio) src); - if (src instanceof org.hl7.fhir.r5.model.Reference) - return convertReference((org.hl7.fhir.r5.model.Reference) src); - if (src instanceof org.hl7.fhir.r5.model.SampledData) - return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); - if (src instanceof org.hl7.fhir.r5.model.Signature) - return convertSignature((org.hl7.fhir.r5.model.Signature) src); - if (src instanceof org.hl7.fhir.r5.model.Address) - return convertAddress((org.hl7.fhir.r5.model.Address) src); - if (src instanceof org.hl7.fhir.r5.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r5.model.HumanName) - return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); - if (src instanceof org.hl7.fhir.r5.model.Meta) - return convertMeta((org.hl7.fhir.r5.model.Meta) src); - if (src instanceof org.hl7.fhir.r5.model.Timing) - return convertTiming((org.hl7.fhir.r5.model.Timing) src); - if (src instanceof org.hl7.fhir.r5.model.Age) - return convertAge((org.hl7.fhir.r5.model.Age) src); - if (src instanceof org.hl7.fhir.r5.model.Count) - return convertCount((org.hl7.fhir.r5.model.Count) src); - if (src instanceof org.hl7.fhir.r5.model.Distance) - return convertDistance((org.hl7.fhir.r5.model.Distance) src); - if (src instanceof org.hl7.fhir.r5.model.Duration) - return convertDuration((org.hl7.fhir.r5.model.Duration) src); - if (src instanceof org.hl7.fhir.r5.model.Money) - return convertMoney((org.hl7.fhir.r5.model.Money) src); - if (src instanceof org.hl7.fhir.r5.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.r5.model.SimpleQuantity) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(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()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r5.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - - public org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - tgt.setImplicitRules(src.getImplicitRules()); - tgt.setLanguage(src.getLanguage()); - } - public void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; - } - } - - - - public org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - private org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; - case INPROCESS: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case NEEDSACTION: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; - } - } - - private org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasEvent()) { - tgt.setType(convertCoding(src.getEvent().getType())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) - tgt.addSubtype(convertCoding(t)); - tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); - tgt.setRecorded(src.getEvent().getDateTime()); - tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); - tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) - tgt.addPurposeOfEvent().addCoding(convertCoding(t)); - } - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); - copyDomainResource(src, tgt); - tgt.getEvent().setType(convertCoding(src.getType())); - for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) - tgt.getEvent().addSubtype(convertCoding(t)); - tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); - tgt.getEvent().setDateTime(src.getRecorded()); - tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); - tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) - for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) - tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addParticipant(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addObject(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setWho(convertReference(src.getReference())); - if (src.hasUserId()) - tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) - tgt.addPurposeOfUse().addCoding(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - if (src.getWho().hasIdentifier()) - tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); - if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) - tgt.setReference(convertReference(src.getWho())); - } - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) - for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) - tgt.addPurposeOfUse(convertCoding(cc)); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; - case _2: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; - case _3: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; - case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; - case _5: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; - default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; - } - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - if (src.hasIdentifier()) - tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - if (src.hasObserver()) - tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); - for (org.hl7.fhir.r5.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasReference()) - tgt.setWhat(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); -// tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); - copyElement(src, tgt); - if (src.hasWhat()) { - if (src.getWhat().hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); - if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) - tgt.setReference(convertReference(src.getWhat())); - } - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); -// tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasValue()) - tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasValueStringType()) - tgt.setValue(src.getValueStringType().getValue().getBytes()); - else if (src.hasValueBase64BinaryType()) - tgt.setValue(src.getValueBase64BinaryType().getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (advisor.ignoreEntry(src)) - return null; - - org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource()); - if (res == null) - res = convertResource(src.getResource()); - tgt.setResource(res); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - if (!tgt.hasAuthor()) - tgt.setAuthor(convertReference(t)); - else - tgt.addContributor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReferenceToCodableReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - private CodeableReference convertReferenceToCodableReference(Reference src) { - CodeableReference tgt = new CodeableReference(); - tgt.setReference(convertReference(src)); - return tgt; - } - - private CodeableReference convertCodeableConceptToCodableReference(CodeableConcept src) { - CodeableReference tgt = new CodeableReference(); - tgt.setConcept(convertCodeableConcept(src)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAuthor()) - tgt.addAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (CodeableReference t : src.getAddresses()) { - if (t.hasReference()) { - tgt.addAddresses(convertReference(t.getReference())); - } - } -// for (org.hl7.fhir.r5.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED; - default: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; - case REVOKED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; - } - } - -// public org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// - public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.r5.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); -// tgt.setKind().add(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setDoNotPerform(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - // tgt.setCategory(convertCodeableConcept(src.getKind())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (CodeableReference t : src.getReason()) - if(t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if(t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getDoNotPerform()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - -// public org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu2.model.ClinicalImpression src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); -// copyDomainResource(src, tgt); -// tgt.setSubject(convertReference(src.getPatient())); -// tgt.setAssessor(convertReference(src.getAssessor())); -// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setDescription(src.getDescription()); -// tgt.setPrevious(convertReference(src.getPrevious())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getProblem()) -// tgt.addProblem(convertReference(t)); -//// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); -// tgt.addProtocol(src.getProtocol()); -// tgt.setSummary(src.getSummary()); -// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) -// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); -// if (src.hasPrognosis()) -// tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); -//// for (org.hl7.fhir.dstu2.model.Reference t : src.getPlan()) -//// tgt.addPlan(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ClinicalImpression tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getSubject())); -// tgt.setAssessor(convertReference(src.getAssessor())); -// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setDescription(src.getDescription()); -// tgt.setPrevious(convertReference(src.getPrevious())); -// for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) -// tgt.addProblem(convertReference(t)); -//// for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); -// for (UriType t : src.getProtocol()) -// tgt.setProtocol(t.asStringValue()); -// tgt.setSummary(src.getSummary()); -// for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) -// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); -// tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); -//// for (org.hl7.fhir.r5.model.Reference t : src.getPlan()) -//// tgt.addPlan(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INPROGRESS: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; -// case COMPLETED: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DRAFT: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; -// case COMPLETED: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; -// } -// } -// -//// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -//// if (src == null || src.isEmpty()) -//// return null; -//// org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -//// copyElement(src, tgt); -//// tgt.setCode(convertCodeableConcept(src.getCode())); -//// for (org.hl7.fhir.dstu2.model.Reference t : src.getItem()) -//// tgt.addItem(convertReference(t)); -//// return tgt; -//// } -//// -//// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -//// if (src == null || src.isEmpty()) -//// return null; -//// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -//// copyElement(src, tgt); -//// tgt.setCode(convertCodeableConcept(src.getCode())); -//// for (org.hl7.fhir.r5.model.Reference t : src.getItem()) -//// tgt.addItem(convertReference(t)); -//// return tgt; -//// } -// -// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertCodeableConcept(src.getItem())); -//// tgt.setCause(src.getCause()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent(); -// copyElement(src, tgt); -// if (src.hasItemCodeableConcept()) -// try { -// tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); -// } catch (org.hl7.fhir.exceptions.FHIRException e) { -// } -//// tgt.setCause(src.getCause()); -// return tgt; -// } -// - public org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReason(convertCodeableConcept(t.getConcept())); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.EventStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.ONHOLD; - case REJECTED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; - case FAILED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE; - default: return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; - case NOTDONE: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.r5.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CommunicationRequest tgt = new org.hl7.fhir.r5.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.addInformationProvider(convertReference(src.getSender())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setOccurrence(convertType(src.getScheduled())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - tgt.setAuthoredOn(src.getRequestedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.r5.model.Enumerations.RequestPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { - for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP; - } - return null; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r5.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getInformationProviderFirstRep())); - for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setScheduled(convertType(src.getOccurrence())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReason(convertCodeableConcept(t.getConcept())); - tgt.setRequestedOn(src.getAuthoredOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r5.model.Enumerations.RequestPriority priority) { - org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; - case PLANNED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case REQUESTED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD; - case REJECTED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR; -// case FAILED: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.FAILED; - default: return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; -// case PLANNED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addCategory(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - try { - tgt.setConfidentiality(org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.fromCode(src.getConfidentiality())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - tgt.setConfidentiality(src.getConfidentiality().toCode()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.addMode(convertCompositionAttestationMode(src.getMode())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - try { - tgt.setMode(org.hl7.fhir.r5.model.Enumerations.ListMode.fromCode(src.getMode())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - tgt.setMode(src.getMode().toCode()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; - - } - - public org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - org.hl7.fhir.r5.model.DataType r = convertType(src.getSource()); - tgt.setSource(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); - r = convertType(src.getTarget()); - tgt.setTarget(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); - for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - public org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - - private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) { - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - } - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (t.getEquivalence() == org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { - tgt.setNoMap(true); - } else { - tgt.addTarget(convertTargetElementComponent(t)); - } - res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); - } - return res; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getSource()); - tgt.setCode(src.getCode()); - if (src.hasNoMap() && src.getNoMap() == true) { - tgt.addTarget(new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); - } - else { - for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - } - return tgt; - } - - public org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getTarget()); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); - tgt.setComments(src.getComment()); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; - case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; - default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case BROADER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; - case NARROWER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; - case NOTRELATEDTO: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getCodeSystem()); - tgt.setValue(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setCodeSystem(src.getSystem()); - tgt.setCode(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasDateRecorded()) - tgt.setRecordedDate(src.getDateRecorded()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.addStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasRecordedDate()) - tgt.setDateRecorded(src.getRecordedDate()); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.setCategory(convertCodeableConcept(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); - for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); - cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); - return cc; - } - - private static String convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - for (org.hl7.fhir.r5.model.Coding c : src.getCoding()) { - if ("http://hl7.org/fhir/condition-clinical".equals(c.getSystem())) - return c.getCode(); - } - return null; - } - - private static org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); - switch (src) { - case PROVISIONAL: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); - return cc; - case DIFFERENTIAL: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); - return cc; - case CONFIRMED: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); - return cc; - case REFUTED: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); - return cc; - case ENTEREDINERROR: - cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); - return cc; - default: return null; - } - } - - - private static org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; - if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; - } - - - - public org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - tgt.addCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept cc : src.getCode()) - tgt.setCode(convertCodeableConcept(cc)); - for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { - CanonicalType dst = new CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { - Reference dst = new Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - 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())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) -// tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - 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())); - for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (CapabilityStatementRestComponent r : src.getRest()) - for (CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(convertCanonicalToReference(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; - } - } - -// public org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; -// } -// } - - public org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) - tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - boolean batch = false; - boolean transaction = false; - for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { - if (t.getCode().equals(SystemRestfulInteraction.BATCH)) - batch = true; - else - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) - transaction = true; - } - if (batch) - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); - else - tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; - } - } - - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) { - tgt.setType(src.getType()); - } - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); - org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue())); - org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - - public org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; - } - } - - public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; - } - } - -// public org.hl7.fhir.r5.model.Contract convertContract(org.hl7.fhir.dstu2.model.Contract src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract tgt = new org.hl7.fhir.r5.model.Contract(); -// copyDomainResource(src, tgt); -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent t : src.getRule()) -// tgt.setRule(convertComputableLanguageComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract convertContract(org.hl7.fhir.r5.model.Contract src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract tgt = new org.hl7.fhir.dstu2.model.Contract(); -// copyDomainResource(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// if (src.hasRule()) -// tgt.addRule(convertComputableLanguageComponent(src.getRule())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu2.model.Contract.ActorComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// tgt.setActor(convertReference(src.getEntity())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ActorComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertReference(src.getActor())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu2.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r5.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// tgt.setType(convertCoding(src.getType())); -// tgt.setParty(convertReference(src.getParty())); -// if (src.hasSignature()) -// tgt.addSignature(new org.hl7.fhir.r5.model.Signature().setData(src.getSignature().getBytes())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r5.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu2.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// tgt.setType(convertCoding(src.getType())); -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) -// tgt.setSignature(Base64.encodeBase64String(t.getData())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu2.model.Contract.TermComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.TermComponent tgt = new org.hl7.fhir.r5.model.Contract.TermComponent(); -// copyElement(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermActorComponent t : src.getActor()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r5.model.Contract.TermComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermComponent(); -// copyElement(src, tgt); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setIssued(src.getIssued()); -// tgt.setApplies(convertPeriod(src.getApplies())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Contract.AgentComponent t : src.getAgent()) -// tgt.addActor(convertTermAgentComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu2.model.Contract.TermActorComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// tgt.setActor(convertReference(src.getEntity())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermActorComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertReference(src.getActor())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent(); -// copyElement(src, tgt); -// tgt.setEntity(convertType(src.getEntity())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setEffectiveTime(src.getEffectiveTime()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// tgt.setFactor(src.getFactor()); -// tgt.setPoints(src.getPoints()); -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r5.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } - - - public org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); - } - tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public org.hl7.fhir.dstu2.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DataElement tgt = new org.hl7.fhir.dstu2.model.DataElement(); -// copyDomainResource(src, tgt); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setVersion(src.getVersion()); -// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// tgt.setPublisher(src.getPublisher()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setName(src.getName()); -// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertDataElementContactComponent(t)); -// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) -// if (t.hasValueCodeableConcept()) -// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); -// tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; -// } -// } - - public org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - -// public org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// tgt.setIdentity(src.getIdentity()); -// tgt.setUri(src.getUri()); -// tgt.setName(src.getName()); -// tgt.setComments(src.getComment()); -// return tgt; -// } - - public org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCode(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setIdentified(convertDateTime(src.getDateElement())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCode())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasIdentifiedDateTimeType()) - tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - -// public org.hl7.fhir.r5.model.Device convertDevice(org.hl7.fhir.dstu2.model.Device src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Device tgt = new org.hl7.fhir.r5.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setUdi((new org.hl7.fhir.r5.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); -// tgt.setStatus(convertDeviceStatus(src.getStatus())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setManufacturer(src.getManufacturer()); -// tgt.setManufactureDate(src.getManufactureDate()); -// tgt.setExpirationDate(src.getExpiry()); -// tgt.setModel(src.getModel()); -// tgt.setVersion(src.getVersion()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Device convertDevice(org.hl7.fhir.r5.model.Device src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Device tgt = new org.hl7.fhir.dstu2.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(src.getUdi().getDeviceIdentifier()); -// tgt.setStatus(convertDeviceStatus(src.getStatus())); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setManufacturer(src.getManufacturer()); -// tgt.setManufactureDate(src.getManufactureDate()); -// tgt.setExpiry(src.getExpirationDate()); -// tgt.setModel(src.getModel()); -// tgt.setVersion(src.getVersion()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AVAILABLE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ACTIVE; -// case NOTAVAILABLE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r5.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; -// case INACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; -// } -// } -// -// public org.hl7.fhir.r5.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.DeviceComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setLastSystemChange(src.getLastSystemChange()); -// tgt.setSource(convertReference(src.getSource())); -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r5.model.DeviceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// tgt.setLastSystemChange(src.getLastSystemChange()); -// tgt.setSource(convertReference(src.getSource())); -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -// } -// -// public org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// - public org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - if (src.hasBodySiteCodeableConcept()) - tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) - tgt.addNote().setText(t.getValue()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - tgt.setBodySite(convertType(src.getBodySite())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addIndication(convertCodeableConcept(t.getConcept())); - for (Annotation t : src.getNote()) - tgt.addNotes(t.getText()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - -// public org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; -// default: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; -// default: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; -// } -// } - - - public org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addMedia(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addConclusionCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - -// public org.hl7.fhir.r5.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu2.model.DocumentManifest src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.DocumentManifest tgt = new org.hl7.fhir.r5.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setSubject(convertReference(src.getSubject())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// tgt.setCreated(src.getCreated()); -// tgt.setSource(src.getSource()); -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r5.model.DocumentManifest src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DocumentManifest tgt = new org.hl7.fhir.dstu2.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setSubject(convertReference(src.getSubject())); -// for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// tgt.setCreated(src.getCreated()); -// tgt.setSource(src.getSource()); -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } - - public org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - -// public org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// tgt.setP(convertType(src.getP())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// tgt.setP(convertType(src.getP())); -// return tgt; -// } - - public org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.addCategory(convertCodeableConcept(src.getClass_())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setDate(src.getCreated()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertDocStatus(CodeableConcept cc) { - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) - return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) - return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) - return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) - return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; - - return null; - } - - private CodeableConcept convertDocStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus docStatus) { - CodeableConcept cc = new CodeableConcept (); - switch (docStatus) { - case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; - case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; - case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; - case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getDate()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - - public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) - tgt.setFormat(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - tgt.addFormat(convertCoding(src.getFormat())); - return tgt; - } - - public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.addEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounterFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Reference tgt = convertReference(src.getRef()); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src)); - return tgt; - } - - - public org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.addAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReason(convertCodeableConcept(t.getConcept())); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case INPROGRESS: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case FINISHED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; - default: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; - case INPROGRESS: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; - } - } - - public org.hl7.fhir.r5.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPATIENT: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); - case OUTPATIENT: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); - case AMBULATORY: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); - case EMERGENCY: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); - case HOME: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); - case FIELD: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); - case DAYTIME: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); - case VIRTUAL: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); - default: return null; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.r5.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src.getSystem().equals("http://terminology.hl7.org/v3/ActCode")) { - if (src.getCode().equals("IMP")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; - if (src.getCode().equals("AMB")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; - if (src.getCode().equals("EMER")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; - if (src.getCode().equals("HH")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; - if (src.getCode().equals("FLD")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; - if (src.getCode().equals("")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; - if (src.getCode().equals("VR")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; - } - return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; - } - -// public org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - - public org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.EnrollmentRequest tgt = new org.hl7.fhir.r5.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); - tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setCandidate(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r5.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); -// tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); -// tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.r5.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.EnrollmentResponse tgt = new org.hl7.fhir.r5.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setRequest(convertReference(src.getRequest())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setRequestProvider(convertReference(src.getRequestProvider())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r5.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// tgt.setRequest(convertReference(src.getRequestReference())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); -// tgt.setOrganization(convertReference(src.getOrganizationReference())); -// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); - return tgt; - } - - public org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - - public org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.r5.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.r5.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { -// if (t.hasType()) -// tgt.addServiceType(convertCodeableConcept(t.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(tj)); - } - tgt.addLocation(convertReference(src.getLocation())); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility()) - tgt.getEligibilityFirstRep().setCode(convertCodeableConcept(src.getEligibility())); - if (src.hasEligibilityNote()) - tgt.getEligibilityFirstRep().setComment(src.getEligibilityNote()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) - tgt.addProgram().setText(t.getValue()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) -// tgt.addServiceType().setType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) { - if (!tgt.hasServiceType()) - tgt.addServiceType(); - tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) - tgt.setLocation(convertReference(t)); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); - tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgram()) - if (t.hasText()) - tgt.addProgramName(t.getText()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; - default: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - -// public org.hl7.fhir.r5.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu2.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ImagingObjectSelection tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.r5.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) -// tgt.addFrame(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) -// tgt.addFrames(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu2.model.UnsignedIntType t : src.getFrameNumbers()) -// tgt.addNumber(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getNumber()) -// tgt.addFrameNumbers(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// - - private org.hl7.fhir.r5.model.Reference getPerformer(List practitioner) { - for (ImmunizationPerformerComponent p : practitioner) { - if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "AP")) - return p.getActor(); - } - return null; - } - - private org.hl7.fhir.r5.model.Reference getRequester(List practitioner) { - for (ImmunizationPerformerComponent p : practitioner) { - if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "OP")) - return p.getActor(); - } - return null; - } - - private boolean hasConcept(org.hl7.fhir.r5.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.r5.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - - public org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) { - tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - } - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu2.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - } - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - if (id != null) - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (id.equals(t.getId())) - return t; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t.setName("Default Package"); - t.setId(id); - return t; - } - - public org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); - tgt.setUri(src.getUri()); - return tgt; - } - - - public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) - tgt.setExample(convertReferenceToCanonical(src.getExampleFor())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (src.hasType()) { - tgt.setType(src.getType()); - } - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) { - tgt.setName(convertUriToUrl(src.getSourceElement())); - } - tgt.setTitle(src.getName()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { - switch (kind) { - case PAGE: return GuidePageGeneration.HTML; - default: return GuidePageGeneration.GENERATED; - } - } - - - private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { - switch (generation) { - case HTML: return GuidePageKind.PAGE; - default: return GuidePageKind.RESOURCE; - } - } - - public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - tgt.setName(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - - public org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.addType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.r5.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.r5.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } -// -// public org.hl7.fhir.r5.model.Media convertMedia(org.hl7.fhir.dstu2.model.Media src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Media tgt = new org.hl7.fhir.r5.model.Media(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setType(convertDigitalMediaType(src.getType())); -// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); -// tgt.setView(convertCodeableConcept(src.getView())); -// tgt.setSubject(convertReference(src.getSubject())); -// tgt.setOperator(convertReference(src.getOperator())); -// tgt.getDevice().setDisplay(src.getDeviceName()); -// tgt.setHeight(src.getHeight()); -// tgt.setWidth(src.getWidth()); -// tgt.setFrames(src.getFrames()); -// tgt.setDuration(src.getDuration()); -// tgt.setContent(convertAttachment(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.r5.model.Media src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Media tgt = new org.hl7.fhir.dstu2.model.Media(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setType(convertDigitalMediaType(src.getType())); -// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); -// tgt.setView(convertCodeableConcept(src.getView())); -// tgt.setSubject(convertReference(src.getSubject())); -// tgt.setOperator(convertReference(src.getOperator())); -// tgt.setDeviceName(src.getDevice().getDisplay()); -// tgt.setHeight(src.getHeight()); -// tgt.setWidth(src.getWidth()); -// tgt.setFrames(src.getFrames()); -// tgt.setDuration(src.getDuration()); -// tgt.setContent(convertAttachment(src.getContent())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Media.DigitalCategoryType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PHOTO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.PHOTO; -// case VIDEO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.VIDEO; -// case AUDIO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.AUDIO; -// default: return org.hl7.fhir.r5.model.Media.DigitalMediaType.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r5.model.Media.DigitalMediaType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PHOTO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; -// case VIDEO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; -// case AUDIO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; -// default: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; -// } -// } -// -// public org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.dstu2.model.Medication src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); -// copyDomainResource(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// tgt.setIsBrand(src.getIsBrand()); -// tgt.setManufacturer(convertReference(src.getManufacturer())); -//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); -//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication tgt = new org.hl7.fhir.dstu2.model.Medication(); -// copyDomainResource(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// tgt.setIsBrand(src.getIsBrand()); -// tgt.setManufacturer(convertReference(src.getManufacturer())); -//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); -//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.r5.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationPackageComponent(); -// copyElement(src, tgt); -// tgt.setContainer(convertCodeableConcept(src.getContainer())); -// for (org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent t : src.getContent()) -// tgt.addContent(convertMedicationPackageContentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r5.model.Medication.MedicationPackageComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent(); -// copyElement(src, tgt); -// tgt.setContainer(convertCodeableConcept(src.getContainer())); -// for (org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent t : src.getContent()) -// tgt.addContent(convertMedicationPackageContentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } - - public org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(); - copyElement(src, tgt); - switch (src.getValue()) { - case COMPLETED: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED); break; - case ENTEREDINERROR: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ENTEREDINERROR); break; - case INPROGRESS: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.INPROGRESS); break; - case NULL: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.NULL); break; - case ONHOLD: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ONHOLD); break; - case STOPPED: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED); break; - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration(new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatusEnumFactory()); - copyElement(src, tgt); - switch (src.getValue()) { - case COMPLETED: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); break; - case ENTEREDINERROR: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); break; - case INPROGRESS: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); break; - case NULL: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL); break; - case ONHOLD: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); break; - case STOPPED: tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED); break; - } - return tgt; - } - - public org.hl7.fhir.r5.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - return tgt; - } - - public org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) - tgt.setResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - if (src.hasResponsibleParty()) - tgt.addResponsibleParty(convertReference(src.getResponsibleParty())); - return tgt; - } - -// public org.hl7.fhir.r5.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.MedicationOrder tgt = new org.hl7.fhir.r5.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReasonCodeableConcept()) -// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); -// if (src.hasReasonReference()) -// tgt.addReasonReference(convertReference(src.getReasonReference())); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// if (src.hasNote()) -// tgt.addNote().setText(src.getNote()); -// for (org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.r5.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder tgt = new org.hl7.fhir.dstu2.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) -// tgt.setReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) -// tgt.setReason(convertReference(t)); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) -// tgt.setNote(t.getText()); -// for (org.hl7.fhir.r5.model.DosageInstruction t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } - - public org.hl7.fhir.r5.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - -// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } - - public org.hl7.fhir.r5.model.MedicationUsage convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MedicationUsage tgt = new org.hl7.fhir.r5.model.MedicationUsage(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) - tgt.addDerivedFrom(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationUsage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED; - default: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - if (src.hasRate()) { - DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); - copyDomainResource(src, tgt); -// tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); - copyDomainResource(src, tgt); -// tgt.setTimestamp(src.getTimestamp()); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) - tgt.addData(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.addNote().setText(src.getComments()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) - if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER) - tgt.addHasMember(convertReference(t.getTarget())); - else if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM) - tgt.addDerivedFrom(convertReference(t.getTarget())); for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept c : src.getCategory()) - tgt.setCategory(convertCodeableConcept(c)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - if (src.hasNote()) - tgt.setComments(src.getNoteFirstRep().getText()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER)); - for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM)); - for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - tgt.setType(convertCodeableConcept(src.getMeaning())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); -// for (org.hl7.fhir.r5.model.CodeableConcept c : src.getMeaning()) - tgt.setMeaning(convertCodeableConcept(src.getType())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - - public org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType type) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(type); - tgt.setTarget(convertReference(src)); - return tgt; - } - - - public org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setComment(src.getNotes()); - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setIdempotent(!src.getAffectsState()); - tgt.setCode(src.getCode()); - tgt.setNotes(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { - tgt.setType(FHIRAllTypes.STRING); - tgt.setSearchType(SearchParamType.fromCode(src.getType())); - } else { - tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); - } - tgt.addTargetProfile(src.getProfile().getReference()); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSearchType()) { - tgt.setType(src.getSearchType().toCode()); - } else - tgt.setType(src.getType().toCode()); - for (org.hl7.fhir.r5.model.UriType t: src.getTargetProfile()) - tgt.setProfile(new Reference(t.getValue())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; - default: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - DataType t = convertType(src.getValueSet()); - if (t != null) { - if (t instanceof org.hl7.fhir.r5.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); - } - return tgt; - } - - public org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; - } - } - - - public org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.addType(convertCodeableConcept(src.getType())); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - - public org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasAnimal()) - tgt.addExtension(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) - tgt.addGeneralPractitioner(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) - tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); - for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) - tgt.addCareProvider(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); - tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); - copyElement(src, tgt); - if (src.hasSpecies()) - tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); - if (src.hasBreed()) - tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); - if (src.hasGenderStatus()) - tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); - copyElement(src, tgt); - if (src.hasExtension("species")) - tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); - if (src.hasExtension("breed")) - tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); - if (src.hasExtension("genderStatus")) - tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); - return tgt; - } - - public org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACE: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; - case REFER: return org.hl7.fhir.r5.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.r5.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REPLACES: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; - case REFER: return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; - } - } - - - public org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - if (src.hasName()) - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) -// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.setName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent t : src.getRole()) -// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - -// public org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setOrganization(convertReference(src.getManagingOrganization())); -// tgt.setCode(convertCodeableConcept(src.getRole())); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setManagingOrganization(convertReference(src.getOrganization())); -// tgt.setRole(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - -// public org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.dstu2.model.Provenance src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getTarget()) -// tgt.addTarget(convertReference(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// tgt.setRecorded(src.getRecorded()); -// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) -// for (org.hl7.fhir.dstu2.model.Coding tc : t.getCoding()) -// tgt.addReason(convertCoding(tc)); -// for (org.hl7.fhir.dstu2.model.Coding t : src.getActivity().getCoding()) -// tgt.setActivity(convertCoding(t)); -// tgt.setLocation(convertReference(src.getLocation())); -// for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) -// tgt.addPolicy(t.getValue()); -// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.addAgent(convertProvenanceAgentComponent(t)); -// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) -// tgt.addEntity(convertProvenanceEntityComponent(t)); -// for (org.hl7.fhir.dstu2.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) -// tgt.addTarget(convertReference(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// tgt.setRecorded(src.getRecorded()); -// for (org.hl7.fhir.r5.model.Coding t : src.getReason()) -// tgt.addReason().addCoding(convertCoding(t)); -// tgt.setActivity(new org.hl7.fhir.dstu2.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); -// tgt.setLocation(convertReference(src.getLocation())); -// for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) -// tgt.addPolicy(t.getValue()); -// for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.addAgent(convertProvenanceAgentComponent(t)); -// for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) -// tgt.addEntity(convertProvenanceEntityComponent(t)); -// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); -// copyElement(src, tgt); -//// tgt.setRole(convertCoding(src.getRole())); -// tgt.setWho(convertReference(src.getActor())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent(); -// copyElement(src, tgt); -//// tgt.setRole(convertCoding(src.getRole())); -// if (src.hasWhoReference()) -// tgt.setActor(convertReference(src.getWhoReference())); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertProvenanceEntityRole(src.getRole())); -// if (src.hasReference()) -// tgt.setWhat(new org.hl7.fhir.r5.model.Reference().setReference(src.getReference())); -// tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertProvenanceEntityRole(src.getRole())); -// if (src.hasWhatReference() && src.getWhatReference().hasReference()) -// tgt.setReference(src.getWhatReference().getReference()); -// for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) -// tgt.setAgent(convertProvenanceAgentComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DERIVATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; -// case REVISION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; -// case QUOTATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; -// case SOURCE: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; -// default: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DERIVATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; -// case REVISION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; -// case QUOTATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; -// case SOURCE: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; -// default: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; -// } -// } - - public org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); - tgt.setTitle(root.getTitle()); - for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - tgt.addItem(convertQuestionnaireGroupComponent(root)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); - root.setTitle(src.getTitle()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { - root.addConcept(convertCoding(t)); - } - for (CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) - root.addGroup(convertQuestionnaireGroupComponent(t)); - else - root.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireQuestionType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) - tgt.addAnswerOption().setValue(convertCoding(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - else - tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - if (t.hasValueCoding()) - try { - tgt.addOption(convertCoding(t.getValueCoding())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); + public static org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; } - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; } - } - public org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; - case DATE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; - case DATETIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; - case TIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; - case STRING: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; - case TEXT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; - case URL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; - case CHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; - default: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - - if (src.getItem().size() != 1) - throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? - - tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); - return tgt; - } - - - public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(Long.valueOf(src.getSize())); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; } - } - public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - if (t.hasAnswer()) - tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); - else - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - - public org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDate(src.getDate()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDateElement(src.getOccurrenceDateTimeType()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) - tgt.addServiceType(convertCodeableConcept(t)); - tgt.addActor(convertReference(src.getActor())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActorFirstRep())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(Math.toIntExact(src.getSize())); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; } - } - public org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getIdElement().getIdPart())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) { - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + public static org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; } - if (src.hasConstrainedType()) - tgt.setType(src.getConstrainedType()); - else if (src.getSnapshot().hasElement()) - tgt.setType(src.getSnapshot().getElement().get(0).getPath()); - else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) - tgt.setType(src.getDifferential().getElement().get(0).getPath()); - else - tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); - tgt.setBaseDefinition(src.getBase()); - tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElementFirstRep().getType().clear(); - if (tgt.hasDifferential()) - tgt.getDifferential().getElementFirstRep().getType().clear(); - - - if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getIdElement().getIdPart())) { - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); -// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } -// for (ElementDefinition ed : tgt.getDifferential().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } - tgt.setType(tgt.getIdElement().getIdPart()); + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; } - if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { - for (ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + + public static org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; } - } } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + public static org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; + } } - tgt.setConstrainedType(src.getType()); - tgt.setBase(src.getBaseDefinition()); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasBase()) { - if (tgt.hasDifferential()) - tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; } - return tgt; - } - private String tail(String base) { - return base.substring(base.lastIndexOf("/")+1); - } - - public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "integer64", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) - return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; } - } - private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + public static org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; } - } - private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource102(tn)) { - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; + } } - } - private static boolean isResource102(String tn) { - return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression", - "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent", - "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", - "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection", - "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", - "MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization", - "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire", - "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance", - "SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription"); - } - - public org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + public static org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; + } } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; } - return tgt; - } - public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - -// public org.hl7.fhir.r5.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Subscription tgt = new org.hl7.fhir.r5.model.Subscription(); -// copyDomainResource(src, tgt); -// tgt.setCriteria(src.getCriteria()); -// for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setReason(src.getReason()); -// tgt.setStatus(convertSubscriptionStatus(src.getStatus())); -// tgt.setError(src.getError()); -// tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); -// tgt.setEnd(src.getEnd()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.r5.model.Subscription src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); -// copyDomainResource(src, tgt); -// tgt.setCriteria(src.getCriteria()); -// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// tgt.setReason(src.getReason()); -// tgt.setStatus(convertSubscriptionStatus(src.getStatus())); -// tgt.setError(src.getError()); -// tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); -// tgt.setEnd(src.getEnd()); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case REQUESTED: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ACTIVE; -// case ERROR: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ERROR; -// case OFF: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.OFF; -// default: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r5.model.Subscription.SubscriptionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case REQUESTED: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; -// case ERROR: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; -// case OFF: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; -// default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; -// } -// } -// -// public org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent(); -// copyElement(src, tgt); -// tgt.setType(convertSubscriptionChannelType(src.getType())); -// tgt.setEndpoint(src.getEndpoint()); -// tgt.setPayload(src.getPayload()); -// tgt.addHeader(src.getHeader()); -// return tgt; -// } -// -// public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); -// copyElement(src, tgt); -// tgt.setType(convertSubscriptionChannelType(src.getType())); -// tgt.setEndpoint(src.getEndpoint()); -// tgt.setPayload(src.getPayload()); -// if (src.hasHeader()) -// tgt.setHeaderElement(convertString(src.getHeader().get(0))); -// return tgt; -// } -// -// public org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RESTHOOK: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.RESTHOOK; -// case WEBSOCKET: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.WEBSOCKET; -// case EMAIL: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.EMAIL; -// case SMS: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.SMS; -// case MESSAGE: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.MESSAGE; -// default: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.NULL; -// } -// } -// -// public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RESTHOOK: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; -// case WEBSOCKET: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; -// case EMAIL: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; -// case SMS: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; -// case MESSAGE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; -// default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; -// } -// } - - public org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); - tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); -// tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; } - } - public org.hl7.fhir.r5.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SupplyRequest tgt = new org.hl7.fhir.r5.model.SupplyRequest(); - copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); -// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r5.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); -// for (org.hl7.fhir.r5.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case FAILED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - case CANCELLED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.NULL; + public static org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; - case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; } - } - public org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasIdentifier()) { - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + public static org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; } - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - public org.hl7.fhir.r5.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getConformance())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.r5.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertCanonicalToReference(src.getCapabilitiesElement())); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(TestScript.FHIRDefinedType.fromCode(src.getResource())); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource().toCode()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return "application/fhir+xml"; - case JSON: return "application/fhir+json"; - default: return null; - } -} - - private static org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException { - if (src == null) - return null; - if (src.contains("xml")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; - if (src.contains("json")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; - return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; - } - - - public org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(TestScript.FHIRDefinedType.fromCode(src.getResource())); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource().toCode()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; } - } - public org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + public static org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; } - } - public org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; - } - } - - - public org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setCaseSensitive(src.getCaseSensitive()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(src, cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); - tgt.setCode(src.getCode()); - tgt.setDefinition(src.getDefinition()); - tgt.setDisplay(src.getDisplay()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(cs, cc)); - for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) - tgt.addDesignation(convertCodeSystemDesignation(cc)); - return tgt; - } - -public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setUse(convertCoding(src.getUse())); - tgt.setLanguage(src.getLanguage()); - tgt.setValue(src.getValue()); - - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - if (src.hasCompose()) { - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - tgt.getCompose().setLockedDate(src.getLockedDate()); - } - if (src.hasCodeSystem() && advisor != null) { - org.hl7.fhir.r5.model.CodeSystem tgtcs = new org.hl7.fhir.r5.model.CodeSystem(); - copyDomainResource(src, tgtcs); - tgtcs.setUrl(src.getCodeSystem().getSystem()); - tgtcs.addIdentifier(convertIdentifier(src.getIdentifier())); - tgtcs.setVersion(src.getCodeSystem().getVersion()); - tgtcs.setName(src.getName()+" Code System"); - tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgtcs.setExperimental(src.getExperimental()); - tgtcs.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgtcs.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgtcs.setDate(src.getDate()); - tgtcs.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgtcs.addJurisdiction(convertCodeableConcept(t)); + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); else - tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); - tgtcs.setPurpose(src.getRequirements()); - tgtcs.setCopyright(src.getCopyright()); - tgtcs.setContent(CodeSystemContentMode.COMPLETE); - tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) - processConcept(tgtcs.getConcept(), cs, tgtcs); - advisor.handleCodeSystem(tgtcs, tgt); - tgt.setUserData("r2-cs", tgtcs); - tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); - } - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - private void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (cs.getAbstract()) - CodeSystemUtilities.setNotSelectable(tgtcs, ct); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + tgt.setWho(convertReference(src.getWhoReference())); + tgt.setSigFormat(src.getContentType()); + tgt.setData(src.getBlob()); + return tgt; } - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, tgtcs); - } - - private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) - ct.setAbstract(true); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); + public static org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getSigFormat()); + tgt.setBlob(src.getData()); + return tgt; } - for (ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, srcCS); - } - - public org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier i : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(i)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setLockedDate(src.getCompose().getLockedDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) - tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); - org.hl7.fhir.r5.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); - if (srcCS == null && advisor != null) - srcCS = advisor.getCodeSystem(src); - if (srcCS != null) { - tgt.getCodeSystem().setSystem(srcCS.getUrl()); - tgt.getCodeSystem().setVersion(srcCS.getVersion()); - tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) - processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); - + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - - public org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - if (noSystem == null || !t.getSystem().equals(noSystem)) - tgt.addInclude(convertConceptSetComponent(t)); + public static org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - public org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; - default: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + public static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } } - } - public org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; + } } - } - public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - if (src.hasNote()) - tgt.addNote(new org.hl7.fhir.r5.model.Annotation().setText(src.getNote())); - for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + public static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } } - } - public org.hl7.fhir.r5.model.Enumerations.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; - default: return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; + public static org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; + } } - } - public org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) { + tgt.setRank(src.getRank()); + } + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; - default: return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + public static org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) { + tgt.setRank(src.getRank()); + } + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - - - public org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu2.model.Basic) - return convertBasic((org.hl7.fhir.dstu2.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu2.model.Binary) - return convertBinary((org.hl7.fhir.dstu2.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu2.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); -// if (src instanceof org.hl7.fhir.dstu2.model.ClinicalImpression) -// return convertClinicalImpression((org.hl7.fhir.dstu2.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu2.model.Communication) - return convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.Composition) - return convertComposition((org.hl7.fhir.dstu2.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2.model.Condition) - return convertCondition((org.hl7.fhir.dstu2.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu2.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Contract) -// return convertContract((org.hl7.fhir.dstu2.model.Contract) src); - if (src instanceof org.hl7.fhir.dstu2.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Device) -// return convertDevice((org.hl7.fhir.dstu2.model.Device) src); -// if (src instanceof org.hl7.fhir.dstu2.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.dstu2.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.dstu2.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.dstu2.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu2.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu2.model.Flag) - return convertFlag((org.hl7.fhir.dstu2.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu2.model.Group) - return convertGroup((org.hl7.fhir.dstu2.model.Group) src); - if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2.model.List_) - return convertList((org.hl7.fhir.dstu2.model.List_) src); - if (src instanceof org.hl7.fhir.dstu2.model.Location) - return convertLocation((org.hl7.fhir.dstu2.model.Location) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Media) -// return convertMedia((org.hl7.fhir.dstu2.model.Media) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Medication) -// return convertMedication((org.hl7.fhir.dstu2.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.dstu2.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.dstu2.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2.model.Observation) - return convertObservation((org.hl7.fhir.dstu2.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2.model.Organization) - return convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu2.model.Patient) - return convertPatient((org.hl7.fhir.dstu2.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu2.model.Person) - return convertPerson((org.hl7.fhir.dstu2.model.Person) src); - if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Provenance) -// return convertProvenance((org.hl7.fhir.dstu2.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu2.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2.model.Slot) - return convertSlot((org.hl7.fhir.dstu2.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); -// if (src instanceof org.hl7.fhir.dstu2.model.Subscription) -// return convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu2.model.Substance) - return convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.dstu2.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r5.model.Parameters) - return convertParameters((org.hl7.fhir.r5.model.Parameters) src); - if (src instanceof org.hl7.fhir.r5.model.Appointment) - return convertAppointment((org.hl7.fhir.r5.model.Appointment) src); - if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.r5.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.r5.model.Basic) - return convertBasic((org.hl7.fhir.r5.model.Basic) src); - if (src instanceof org.hl7.fhir.r5.model.Binary) - return convertBinary((org.hl7.fhir.r5.model.Binary) src); - if (src instanceof org.hl7.fhir.r5.model.Bundle) - return convertBundle((org.hl7.fhir.r5.model.Bundle) src); - if (src instanceof org.hl7.fhir.r5.model.CarePlan) - return convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); -// if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) -// return convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.r5.model.Communication) - return convertCommunication((org.hl7.fhir.r5.model.Communication) src); - if (src instanceof org.hl7.fhir.r5.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.r5.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.r5.model.Composition) - return convertComposition((org.hl7.fhir.r5.model.Composition) src); - if (src instanceof org.hl7.fhir.r5.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r5.model.Condition) - return convertCondition((org.hl7.fhir.r5.model.Condition) src); - if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); -// if (src instanceof org.hl7.fhir.r5.model.Contract) -// return convertContract((org.hl7.fhir.r5.model.Contract) src); - if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.r5.model.Device) -// return convertDevice((org.hl7.fhir.r5.model.Device) src); -// if (src instanceof org.hl7.fhir.r5.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.r5.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.r5.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.r5.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.r5.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.r5.model.Encounter) - return convertEncounter((org.hl7.fhir.r5.model.Encounter) src); - if (src instanceof org.hl7.fhir.r5.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.r5.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.r5.model.Flag) - return convertFlag((org.hl7.fhir.r5.model.Flag) src); - if (src instanceof org.hl7.fhir.r5.model.Group) - return convertGroup((org.hl7.fhir.r5.model.Group) src); - if (src instanceof org.hl7.fhir.r5.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r5.model.ListResource) - return convertList((org.hl7.fhir.r5.model.ListResource) src); - if (src instanceof org.hl7.fhir.r5.model.Location) - return convertLocation((org.hl7.fhir.r5.model.Location) src); -// if (src instanceof org.hl7.fhir.r5.model.Media) -// return convertMedia((org.hl7.fhir.r5.model.Media) src); -// if (src instanceof org.hl7.fhir.r5.model.Medication) -// return convertMedication((org.hl7.fhir.r5.model.Medication) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.r5.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.r5.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationUsage) - return convertMedicationStatement((org.hl7.fhir.r5.model.MedicationUsage) src); - if (src instanceof org.hl7.fhir.r5.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.r5.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.r5.model.Observation) - return convertObservation((org.hl7.fhir.r5.model.Observation) src); - if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r5.model.Organization) - return convertOrganization((org.hl7.fhir.r5.model.Organization) src); - if (src instanceof org.hl7.fhir.r5.model.Patient) - return convertPatient((org.hl7.fhir.r5.model.Patient) src); - if (src instanceof org.hl7.fhir.r5.model.Person) - return convertPerson((org.hl7.fhir.r5.model.Person) src); - if (src instanceof org.hl7.fhir.r5.model.Practitioner) - return convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); -// if (src instanceof org.hl7.fhir.r5.model.Provenance) -// return convertProvenance((org.hl7.fhir.r5.model.Provenance) src); - if (src instanceof org.hl7.fhir.r5.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.r5.model.Schedule) - return convertSchedule((org.hl7.fhir.r5.model.Schedule) src); - if (src instanceof org.hl7.fhir.r5.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r5.model.Slot) - return convertSlot((org.hl7.fhir.r5.model.Slot) src); - if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); -// if (src instanceof org.hl7.fhir.r5.model.Subscription) -// return convertSubscription((org.hl7.fhir.r5.model.Subscription) src); - if (src instanceof org.hl7.fhir.r5.model.Substance) - return convertSubstance((org.hl7.fhir.r5.model.Substance) src); - if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.r5.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.r5.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.r5.model.TestScript) - return convertTestScript((org.hl7.fhir.r5.model.TestScript) src); - if (src instanceof org.hl7.fhir.r5.model.ValueSet) - return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public TerminologyCapabilities convertTerminologyCapabilities(Parameters src) { - TerminologyCapabilities res = new TerminologyCapabilities(); - for (ParametersParameterComponent p : src.getParameter()) { - if (p.getName().equals("system")) - res.addCodeSystem().setUri(p.getValue().primitiveValue()); + public static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } } - return res; - } - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", - "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", - "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", - "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); - } + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + case URL: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; + } + } + public static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#" + src.getNameReference()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) convertElementDefinitionTypeComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + if (!tgt.hasId()) + tgt.setId(tgt.getPath()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + else + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) convertElementDefinitionTypeComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices == 2 && existsSlicePresent && notExistsSlicePresent) || (slices == 1 && existsSlicePresent != notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static void convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) tgt.addTargetProfile(u.getValue()); + } else { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + } + + public static void convertElementDefinitionTypeComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.r5.model.DataType vs = convertType(src.getValueSet()); + if (vs != null) { + tgt.setValueSet(vs instanceof org.hl7.fhir.r5.model.Reference ? ((org.hl7.fhir.r5.model.Reference) vs).getReference() : vs.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeType) + return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateType) + return convertDate((org.hl7.fhir.dstu2.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IdType) + return convertId((org.hl7.fhir.dstu2.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2.model.OidType) + return convertOid((org.hl7.fhir.dstu2.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.StringType) + return convertString((org.hl7.fhir.dstu2.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2.model.TimeType) + return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UriType) + return convertUri((org.hl7.fhir.dstu2.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.Extension) + return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2.model.Coding) + return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2.model.Period) + return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2.model.Range) + return convertRange((org.hl7.fhir.dstu2.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2.model.Reference) + return convertReference((org.hl7.fhir.dstu2.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2.model.Signature) + return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2.model.Address) + return convertAddress((org.hl7.fhir.dstu2.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2.model.Meta) + return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2.model.Timing) + return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu2.model.Age) + return convertAge((org.hl7.fhir.dstu2.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2.model.Count) + return convertCount((org.hl7.fhir.dstu2.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2.model.Distance) + return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Duration) + return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2.model.Money) + return convertMoney((org.hl7.fhir.dstu2.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r5.model.SimpleQuantity) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(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()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + public static void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + + public static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; + } + } + + static public CodeableReference convertCodeableConceptToCodableReference(CodeableConcept src) { + CodeableReference tgt = new CodeableReference(); + tgt.setConcept(convertCodeableConcept(src)); + return tgt; + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; + } + + public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + public static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Reference getPerformer(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + static public org.hl7.fhir.r5.model.Reference getRequester(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } + + static public boolean hasConcept(org.hl7.fhir.r5.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.r5.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + static public boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + public static org.hl7.fhir.r5.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; + default: + return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: + return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: + return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + return tgt; + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Parameters) + return Parameters10_50.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2.model.Appointment) + return Appointment10_50.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) + return AppointmentResponse10_50.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) + return AuditEvent10_50.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu2.model.Basic) + return Basic10_50.convertBasic((org.hl7.fhir.dstu2.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu2.model.Binary) + return Binary10_50.convertBinary((org.hl7.fhir.dstu2.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu2.model.Bundle) + return Bundle10_50.convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) + return CarePlan10_50.convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu2.model.Communication) + return Communication10_50.convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) + return CommunicationRequest10_50.convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.Composition) + return Composition10_50.convertComposition((org.hl7.fhir.dstu2.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) + return ConceptMap10_50.convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2.model.Condition) + return Condition10_50.convertCondition((org.hl7.fhir.dstu2.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Conformance) + return Conformance10_50.convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2.model.DataElement) + return DataElement10_50.convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) + return DetectedIssue10_50.convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) + return DeviceMetric10_50.convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) + return DeviceUseStatement10_50.convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) + return DiagnosticReport10_50.convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) + return DocumentReference10_50.convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu2.model.Encounter) + return Encounter10_50.convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) + return EnrollmentRequest10_50.convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) + return EnrollmentResponse10_50.convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) + return EpisodeOfCare10_50.convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) + return FamilyMemberHistory10_50.convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu2.model.Flag) + return Flag10_50.convertFlag((org.hl7.fhir.dstu2.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu2.model.Group) + return Group10_50.convertGroup((org.hl7.fhir.dstu2.model.Group) src); + if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) + return HealthcareService10_50.convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) + return ImplementationGuide10_50.convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2.model.List_) + return List10_50.convertList((org.hl7.fhir.dstu2.model.List_) src); + if (src instanceof org.hl7.fhir.dstu2.model.Location) + return Location10_50.convertLocation((org.hl7.fhir.dstu2.model.Location) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) + return MedicationDispense10_50.convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) + return MedicationStatement10_50.convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) + return MessageHeader10_50.convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) + return NamingSystem10_50.convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2.model.Observation) + return Observation10_50.convertObservation((org.hl7.fhir.dstu2.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) + return OperationDefinition10_50.convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) + return OperationOutcome10_50.convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2.model.Organization) + return Organization10_50.convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu2.model.Patient) + return Patient10_50.convertPatient((org.hl7.fhir.dstu2.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu2.model.Person) + return Person10_50.convertPerson((org.hl7.fhir.dstu2.model.Person) src); + if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) + return Practitioner10_50.convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) + return Questionnaire10_50.convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) + return QuestionnaireResponse10_50.convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) + return RiskAssessment10_50.convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu2.model.Schedule) + return Schedule10_50.convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) + return SearchParameter10_50.convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2.model.Slot) + return Slot10_50.convertSlot((org.hl7.fhir.dstu2.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) + return StructureDefinition10_50.convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Substance) + return Substance10_50.convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) + return SupplyDelivery10_50.convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) + return SupplyRequest10_50.convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.TestScript) + return TestScript10_50.convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) + return ValueSet10_50.convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) + return Parameters10_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src); + if (src instanceof org.hl7.fhir.r5.model.Appointment) + return Appointment10_50.convertAppointment((org.hl7.fhir.r5.model.Appointment) src); + if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) + return AppointmentResponse10_50.convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.AuditEvent) + return AuditEvent10_50.convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r5.model.Basic) + return Basic10_50.convertBasic((org.hl7.fhir.r5.model.Basic) src); + if (src instanceof org.hl7.fhir.r5.model.Binary) + return Binary10_50.convertBinary((org.hl7.fhir.r5.model.Binary) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return Bundle10_50.convertBundle((org.hl7.fhir.r5.model.Bundle) src, advisor); + if (src instanceof org.hl7.fhir.r5.model.CarePlan) + return CarePlan10_50.convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r5.model.Communication) + return Communication10_50.convertCommunication((org.hl7.fhir.r5.model.Communication) src); + if (src instanceof org.hl7.fhir.r5.model.CommunicationRequest) + return CommunicationRequest10_50.convertCommunicationRequest((org.hl7.fhir.r5.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.Composition) + return Composition10_50.convertComposition((org.hl7.fhir.r5.model.Composition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return ConceptMap10_50.convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.Condition) + return Condition10_50.convertCondition((org.hl7.fhir.r5.model.Condition) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return Conformance10_50.convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) + return DetectedIssue10_50.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) + return DeviceMetric10_50.convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) + return DeviceUseStatement10_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) + return DiagnosticReport10_50.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return DocumentReference10_50.convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.Encounter) + return Encounter10_50.convertEncounter((org.hl7.fhir.r5.model.Encounter) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentRequest) + return EnrollmentRequest10_50.convertEnrollmentRequest((org.hl7.fhir.r5.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse) + return EnrollmentResponse10_50.convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) + return EpisodeOfCare10_50.convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) + return FamilyMemberHistory10_50.convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r5.model.Flag) + return Flag10_50.convertFlag((org.hl7.fhir.r5.model.Flag) src); + if (src instanceof org.hl7.fhir.r5.model.Group) + return Group10_50.convertGroup((org.hl7.fhir.r5.model.Group) src); + if (src instanceof org.hl7.fhir.r5.model.HealthcareService) + return HealthcareService10_50.convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return ImplementationGuide10_50.convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.ListResource) + return List10_50.convertList((org.hl7.fhir.r5.model.ListResource) src); + if (src instanceof org.hl7.fhir.r5.model.Location) + return Location10_50.convertLocation((org.hl7.fhir.r5.model.Location) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) + return MedicationDispense10_50.convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationUsage) + return MedicationStatement10_50.convertMedicationStatement((org.hl7.fhir.r5.model.MedicationUsage) src); + if (src instanceof org.hl7.fhir.r5.model.MessageHeader) + return MessageHeader10_50.convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return NamingSystem10_50.convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Observation) + return Observation10_50.convertObservation((org.hl7.fhir.r5.model.Observation) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return OperationDefinition10_50.convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return OperationOutcome10_50.convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Organization) + return Organization10_50.convertOrganization((org.hl7.fhir.r5.model.Organization) src); + if (src instanceof org.hl7.fhir.r5.model.Patient) + return Patient10_50.convertPatient((org.hl7.fhir.r5.model.Patient) src); + if (src instanceof org.hl7.fhir.r5.model.Person) + return Person10_50.convertPerson((org.hl7.fhir.r5.model.Person) src); + if (src instanceof org.hl7.fhir.r5.model.Practitioner) + return Practitioner10_50.convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return Questionnaire10_50.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return QuestionnaireResponse10_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) + return RiskAssessment10_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r5.model.Schedule) + return Schedule10_50.convertSchedule((org.hl7.fhir.r5.model.Schedule) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return SearchParameter10_50.convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.Slot) + return Slot10_50.convertSlot((org.hl7.fhir.r5.model.Slot) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return StructureDefinition10_50.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Substance) + return Substance10_50.convertSubstance((org.hl7.fhir.r5.model.Substance) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) + return SupplyDelivery10_50.convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyRequest) + return SupplyRequest10_50.convertSupplyRequest((org.hl7.fhir.r5.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.r5.model.TestScript) + return TestScript10_50.convertTestScript((org.hl7.fhir.r5.model.TestScript) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return ValueSet10_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src, advisor); + throw new FHIRException("Unknown resource " + src.fhirType()); + } + + public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); + } + return res; + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); + } + + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { + return convertResource(src, null); + } + + public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { + return convertResource(src, null); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java index 26eab4a45..b54077b10 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java @@ -19,8 +19,6 @@ package org.hl7.fhir.convertors; * limitations under the License. * #L% */ - - /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -50,7034 +48,2365 @@ package org.hl7.fhir.convertors; */ -// Generated on Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 - -import java.util.ArrayList; -import java.util.List; - -import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.convertors.conv14_30.*; import org.hl7.fhir.dstu2016may.model.CodeableConcept; -import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule; import org.hl7.fhir.dstu3.conformance.ProfileUtilities; -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator; -import org.hl7.fhir.dstu3.model.ConceptMap; -import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.dstu3.model.ContactDetail; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; import org.hl7.fhir.dstu3.model.Enumeration; -import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType; import org.hl7.fhir.dstu3.model.Timing.EventTiming; -import org.hl7.fhir.dstu3.model.UsageContext; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.Utilities; public class VersionConvertor_14_30 { - private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) { - tgt.addExtension(convertExtension(e)); - } + static public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) { + tgt.addExtension(convertExtension(e)); + } + } } - } - private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { - tgt.addExtension(convertExtension(e)); - } + static public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { + tgt.addExtension(convertExtension(e)); + } + } } - } - private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - } - private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); + static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - } - public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - - public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) - tgt.setSliceName(src.getName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertTypeRefComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertTypeRefComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExample().get(0).getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { - if (src.getCode().equals("Reference")) - tgt.setTargetProfile(u.getValue()); - else - tgt.setProfile(u.getValue()); + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { - // We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name. - String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType)t.getValue()).getValue(); - tgt.setProfile(s); + + public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) - copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasTarget()) { - if (src.hasTargetProfile()) { - tgt.addProfile(src.getTargetProfile()); - } - if (src.hasProfile()) { - if (src.getCode().equals("Reference")) { - org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); - t.setValue(new org.hl7.fhir.dstu2016may.model.StringType(src.getProfile())); - tgt.addExtension(t); - } else - tgt.addProfile(src.getProfile()); -// if (!u.toString().toLowerCase().contains("reference")) -// throw new Error("2016May profile doesn't contain the word 'reference':" + u); - } - } else - tgt.addProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) - copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - tgt.addWhen(convertEventTiming(src.getWhen())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) - return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) - return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) - return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) - return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) - return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) - return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) - return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) - return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Age) - return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) - return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Count) - return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) - return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) - return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Money) - return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Period) - return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Range) - return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) - return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) - return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Address) - return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu2016may.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) - return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) - return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(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(convertExtension(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + static public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + static public org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + } } - } - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; } - } - public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLAR: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; - case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) - try { - tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (Enumeration t : src.getOperator()) - tgt.addOperator(t.getValue().toCode()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (ConceptDefinitionPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - return tgt; - } - private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; + public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - private static class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; } - private String source; - private String target; - private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; - } - public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) + public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) + tgt.setSliceName(src.getName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertTypeRefComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertTypeRefComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample().get(0).getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); - } - return res; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (g.hasSource()) - tgt.setSystem(g.getSource()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComments()) - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (g.hasTarget()) - tgt.setSystem(g.getTarget()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComment()) - tgt.setComments(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getExample()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAcronym()) - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - if (src.hasExampleFor()) - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getExample()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAcronym()) - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - if (src.hasExampleFor()) - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setTitle(src.getName()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - if (src.hasFormat()) - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setName(src.getTitle()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - if (src.hasFormat()) - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { - tgt.setType("string"); - tgt.setSearchType(SearchParamType.fromCode(src.getType())); - } else { - tgt.setType(src.getType()); - } - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - for (UsageContext t : src.getUseContext()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - - private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - tgt.setInitial(convertType(src.getInitial())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - tgt.setInitial(convertType(src.getInitial())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasAnswered()) - tgt.setHasAnswer(src.getAnswered()); - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasHasAnswer()) - tgt.setAnswered(src.getHasAnswer()); - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasDisplay()) - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.getDerivation() == TypeDerivationRule.CONSTRAINT) - tgt.setType(src.getBaseType()); - else - tgt.setType(src.getId()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) { - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.getSnapshot().getElementFirstRep().getType().clear(); - } - if (src.hasDifferential()) { - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - tgt.getDifferential().getElementFirstRep().getType().clear(); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setBaseType(src.getType()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2016may.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRuleComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) - tgt.addRuleset(convertTestScriptRulesetComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript tgt = new org.hl7.fhir.dstu2016may.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRuleComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) - tgt.addRuleset(convertTestScriptRulesetComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilities(convertReference(src.getConformance())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertReference(src.getCapabilities())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2016may.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); - tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); - tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.setExtensible(src.getExtensible()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasLockedDate()) - tgt.getCompose().setLockedDate(src.getLockedDate()); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.getCompose().hasLockedDate()) - tgt.setLockedDate(src.getCompose().getLockedDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.setExtensible(src.getExtensible()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - tgt.addInclude(convertConceptSetComponent(t)); - } - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - -/* public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { + if (src.getCode().equals("Reference")) + tgt.setTargetProfile(u.getValue()); + else + tgt.setProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { + String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType) t.getValue()).getValue(); + tgt.setProfile(s); + } + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasTarget()) { + if (src.hasTargetProfile()) { + tgt.addProfile(src.getTargetProfile()); + } + if (src.hasProfile()) { + if (src.getCode().equals("Reference")) { + org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); + t.setValue(new org.hl7.fhir.dstu2016may.model.StringType(src.getProfile())); + tgt.addExtension(t); + } else + tgt.addProfile(src.getProfile()); + } + } else + tgt.addProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue()))); + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + tgt.addWhen(convertEventTiming(src.getWhen())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) + return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) + return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) + return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) + return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) + return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) + return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) + return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) + return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Age) + return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) + return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Count) + return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) + return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) + return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Money) + return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Period) + return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Range) + return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) + return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) + return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Address) + return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu2016may.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) + return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) + return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(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(convertExtension(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; + } + } + + /* public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); @@ -7201,93 +2530,91 @@ public class VersionConvertor_14_30 { } } */ - public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu2016may.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) + return Parameters14_30.convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) + return Bundle14_30.convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) + return CodeSystem14_30.convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) + return CompartmentDefinition14_30.convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) + return ConceptMap14_30.convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) + return Conformance14_30.convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) + return DataElement14_30.convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) + return ImplementationGuide14_30.convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) + return NamingSystem14_30.convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) + return OperationDefinition14_30.convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) + return OperationOutcome14_30.convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) + return Questionnaire14_30.convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) + return QuestionnaireResponse14_30.convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) + return SearchParameter14_30.convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) + return StructureDefinition14_30.convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TestScript) + return TestScript14_30.convertTestScript((org.hl7.fhir.dstu2016may.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) + return ValueSet14_30.convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } + throw new FHIRException("Unknown resource " + src.fhirType()); + } - public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) + public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return Parameters14_30.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return Bundle14_30.convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) + return CodeSystem14_30.convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) + return CompartmentDefinition14_30.convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return ConceptMap14_30.convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return Conformance14_30.convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return DataElement14_30.convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return ImplementationGuide14_30.convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return NamingSystem14_30.convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return OperationDefinition14_30.convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return OperationOutcome14_30.convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return Questionnaire14_30.convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return QuestionnaireResponse14_30.convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return SearchParameter14_30.convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return StructureDefinition14_30.convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return TestScript14_30.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return ValueSet14_30.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "DataElement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "TestScript", "ValueSet"); - } - + throw new FHIRException("Unknown resource " + src.fhirType()); + } + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "DataElement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "TestScript", "ValueSet"); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java index 8ab5484a6..fd17e8412 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java @@ -19,8 +19,6 @@ package org.hl7.fhir.convertors; * limitations under the License. * #L% */ - - /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -50,6776 +48,2544 @@ package org.hl7.fhir.convertors; */ -// Generated on Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 +import org.hl7.fhir.convertors.conv14_40.*; +import org.hl7.fhir.dstu2016may.model.CodeableConcept; +import org.hl7.fhir.dstu2016may.model.Reference; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.conformance.ProfileUtilities; +import org.hl7.fhir.r4.model.CanonicalType; +import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.r4.model.Enumeration; +import org.hl7.fhir.r4.model.Timing.EventTiming; +import org.hl7.fhir.utilities.Utilities; import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; -import org.hl7.fhir.dstu2016may.model.CodeableConcept; -import org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind; -import org.hl7.fhir.dstu2016may.model.Reference; -import org.hl7.fhir.dstu2016may.model.StructureMap; -import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType; -import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.CanonicalType; -import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent; -import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent; -import org.hl7.fhir.r4.model.CodeSystem; -import org.hl7.fhir.r4.model.CodeSystem.FilterOperator; -import org.hl7.fhir.r4.model.ConceptMap; -import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent; -import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.r4.model.ContactDetail; -import org.hl7.fhir.r4.model.ElementDefinition; -import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.r4.model.Enumeration; -import org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration; -import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator; -import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.r4.model.Timing.EventTiming; -import org.hl7.fhir.r4.model.Type; -import org.hl7.fhir.r4.model.UsageContext; -import org.hl7.fhir.utilities.Utilities; - public class VersionConvertor_14_40 { - private static List CANONICAL_URLS = new ArrayList(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } - - private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) { - tgt.addExtension(convertExtension(e)); - } + static public List CANONICAL_URLS = new ArrayList(); + + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - private static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { - tgt.addExtension(convertExtension(e)); - } - } - } - - private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { - org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { - org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { - org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { - org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2016may.model.Reference) - tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; - } - } - - public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCode()) - tgt.setCurrency(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCurrency()) - tgt.setCode(src.getCurrency()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; - } - } - - - public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; - } - } - - public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - if (src.hasContentType()) - tgt.setSigFormat(src.getContentType()); - if (src.hasBlob()) - tgt.setData(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasSigFormat()) - tgt.setContentType(src.getSigFormat()); - if (src.hasData()) - tgt.setBlob(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; - } - } - - public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; - } - } - - public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) - tgt.setSliceName(src.getName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExample().get(0).getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu2016may.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - org.hl7.fhir.dstu2016may.model.ElementDefinition slicingElement = context.get(pos); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) { - boolean isExists = false; - if (!t.asStringValue().contains("@")) { - int slices = 0; - boolean existsSlicePresent = false; - boolean notExistsSlicePresent = false; - String existsPath = slicingElement.getPath() + "." + t.asStringValue(); - for (int i = pos + 1; i < context.size(); i++) { - org.hl7.fhir.dstu2016may.model.ElementDefinition e = context.get(i); - if (e.getPath().equals(slicingElement.getPath())) - slices++; - else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) - break; - else if (e.getPath().equals(existsPath)) { - if (e.hasMin() && e.getMin() > 0 && !e.hasFixed()) - existsSlicePresent = true; - else if (e.hasMax() && e.getMax().equals("0")) - notExistsSlicePresent = true; - } + static public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) { + tgt.addExtension(convertExtension(e)); + } } - isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); - } - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); } - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + static public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { + tgt.addExtension(convertExtension(e)); + } + } } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - } - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - static void convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); + static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - if (tgt.hasTarget()) { - for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { - if (src.getCode().equals("Reference")) - tgt.addTargetProfile(u.getValue()); + + public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { + org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { + org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { + org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { + org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { + org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2016may.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); else - tgt.addProfile(u.getValue()); - } - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { - // We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name. - String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType)t.getValue()).getValue(); - tgt.addProfile(s); - } - } else { - for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) - tgt.addProfile(u.getValue()); - } - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); - } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - - public static void convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - list.add(tgt); - if (src.hasTarget()) { - for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { - tgt.addProfile(u.getValue()); - String baseName = u.getValue().toLowerCase(); - if (baseName.contains("reference") && !baseName.contains("documentreference")) - throw new Error("2016May Target profile contains the word 'reference':" + u); - } - for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { - if (src.getCode().equals("Reference")) { - org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); - t.setValue(convertType(u)); - tgt.addExtension(t); - } else - tgt.addProfile(u.getValue()); -// if (!u.toString().toLowerCase().contains("reference")) -// throw new Error("2016May profile doesn't contain the word 'reference':" + u); - } - } else { - for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { - tgt.addProfile(u.getValue()); - } - } - for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); - } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - - private static org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; - } - } - - private static org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; - } - } - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(convertToR4Expression(src.getExpression())); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(convertTo2016MayExpression(src.getExpression())); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static String convertToR4Expression(String oldExpression) { - String pass1 = oldExpression.replaceAll("\\$context","%context").replaceAll("\\$resource", "%resource").replaceAll("code\\+profile", "code&profile").replaceAll("path\\+'\\.'", "path&'.'").replaceAll("fullUrl\\+resource", "fullUrl&resource"); - String pass2 = pass1; - if (pass1.endsWith(".distinct()")) - pass2 = pass1.substring(0, pass2.length() - 11) + ".isDistinct()"; - String pass3 = pass2; - if (pass2.endsWith(".empty() or (type.count() = 1)")) - pass3 = pass2.substring(0, pass2.length() - 30) + ".empty() or (type.count() <= 1)"; - String pass4 = pass3; - if (pass3.equals("duration >= 0")) - pass4 = "duration.exists() implies duration >= 0"; - else if (pass3.equals("period >= 0")) - pass4 = "period.exists() implies period >= 0"; - else if (pass3.equals("fullUrl.empty() xor resource")) - pass4 = "fullUrl.empty() xor resource.exists()"; - return pass4; - } - - public static String convertTo2016MayExpression(String newExpression) { - String pass1 = newExpression.replaceAll("%context","\\$context").replaceAll("%resource", "\\$resource").replaceAll("code&profile", "code+profile").replaceAll("path&'\\.'", "path+'.'").replaceAll("fullUrl%resource", "fullUrl+resource"); - String pass2 = pass1; - if (pass1.endsWith(".isDistinct()")) - pass2 = pass1.substring(0, pass1.length() - 13) + ".distinct()"; - String pass3 = pass2; - if (pass2.endsWith(".empty() or (type.count() <= 1)")) - pass3 = pass2.substring(0, pass2.length() - 31) + ".empty() or (type.count() = 1)"; - String pass4 = pass3; - if (pass3.equals("duration.exists() implies duration >= 0")) - pass4 = "duration >= 0"; - else if (pass3.equals("period.exists() implies period >= 0")) - pass4 = "period >= 0"; - else if (pass3.equals("fullUrl.empty() xor resource.exists()")) - pass4 = "fullUrl.empty() xor resource"; - return pass4; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - org.hl7.fhir.r4.model.Type t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r4.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); - } - return tgt; - } - - private static org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; - } - } - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; - } - } - - public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - tgt.addWhen(convertEventTiming(src.getWhen())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; - } - } - - private static org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; - } - } - - public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) - return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) - return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) - return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) - return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) - return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) - return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) - return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) - return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Age) - return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) - return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Count) - return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) - return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) - return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Money) - return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Period) - return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Range) - return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) - return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) - return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Address) - return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) - return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) - return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r4.model.BooleanType) - return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r4.model.CodeType) - return convertCode((org.hl7.fhir.r4.model.CodeType) src); - if (src instanceof org.hl7.fhir.r4.model.DateType) - return convertDate((org.hl7.fhir.r4.model.DateType) src); - if (src instanceof org.hl7.fhir.r4.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r4.model.DecimalType) - return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r4.model.IdType) - return convertId((org.hl7.fhir.r4.model.IdType) src); - if (src instanceof org.hl7.fhir.r4.model.InstantType) - return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r4.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r4.model.OidType) - return convertOid((org.hl7.fhir.r4.model.OidType) src); - if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r4.model.StringType) - return convertString((org.hl7.fhir.r4.model.StringType) src); - if (src instanceof org.hl7.fhir.r4.model.TimeType) - return convertTime((org.hl7.fhir.r4.model.TimeType) src); - if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r4.model.UriType) - return convertUri((org.hl7.fhir.r4.model.UriType) src); - if (src instanceof org.hl7.fhir.r4.model.UuidType) - return convertUuid((org.hl7.fhir.r4.model.UuidType) src); - if (src instanceof org.hl7.fhir.r4.model.Extension) - return convertExtension((org.hl7.fhir.r4.model.Extension) src); - if (src instanceof org.hl7.fhir.r4.model.Narrative) - return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); - if (src instanceof org.hl7.fhir.r4.model.Age) - return convertAge((org.hl7.fhir.r4.model.Age) src); - if (src instanceof org.hl7.fhir.r4.model.Annotation) - return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); - if (src instanceof org.hl7.fhir.r4.model.Attachment) - return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); - if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r4.model.Coding) - return convertCoding((org.hl7.fhir.r4.model.Coding) src); - if (src instanceof org.hl7.fhir.r4.model.Count) - return convertCount((org.hl7.fhir.r4.model.Count) src); - if (src instanceof org.hl7.fhir.r4.model.Distance) - return convertDistance((org.hl7.fhir.r4.model.Distance) src); - if (src instanceof org.hl7.fhir.r4.model.Duration) - return convertDuration((org.hl7.fhir.r4.model.Duration) src); - if (src instanceof org.hl7.fhir.r4.model.Identifier) - return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); - if (src instanceof org.hl7.fhir.r4.model.Money) - return convertMoney((org.hl7.fhir.r4.model.Money) src); - if (src instanceof org.hl7.fhir.r4.model.Period) - return convertPeriod((org.hl7.fhir.r4.model.Period) src); - if (src instanceof org.hl7.fhir.r4.model.Quantity) - return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); - if (src instanceof org.hl7.fhir.r4.model.Range) - return convertRange((org.hl7.fhir.r4.model.Range) src); - if (src instanceof org.hl7.fhir.r4.model.Ratio) - return convertRatio((org.hl7.fhir.r4.model.Ratio) src); - if (src instanceof org.hl7.fhir.r4.model.Reference) - return convertReference((org.hl7.fhir.r4.model.Reference) src); - if (src instanceof org.hl7.fhir.r4.model.SampledData) - return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); - if (src instanceof org.hl7.fhir.r4.model.Signature) - return convertSignature((org.hl7.fhir.r4.model.Signature) src); - if (src instanceof org.hl7.fhir.r4.model.Address) - return convertAddress((org.hl7.fhir.r4.model.Address) src); - if (src instanceof org.hl7.fhir.r4.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r4.model.HumanName) - return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); - if (src instanceof org.hl7.fhir.r4.model.Meta) - return convertMeta((org.hl7.fhir.r4.model.Meta) src); - if (src instanceof org.hl7.fhir.r4.model.Timing) - return convertTiming((org.hl7.fhir.r4.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - private static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r4.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; - } - } - - public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; - } - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; - } - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLAR: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; - case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) - try { - tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (Enumeration t : src.getOperator()) - tgt.addOperator(t.getValue().toCode()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r4.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (ConceptDefinitionPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CompartmentDefinition tgt = new org.hl7.fhir.r4.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r4.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.r4.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - org.hl7.fhir.r4.model.Type tt = convertType(src.getSource()); - tgt.setSource(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt); - tt = convertType(src.getTarget()); - tgt.setTarget(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.getSource() instanceof CanonicalType) - tgt.setSource(convertCanonicalToReference((CanonicalType)src.getSource())); - else - tgt.setSource(convertType(src.getSource())); - if (src.getTarget() instanceof CanonicalType) - tgt.setTarget(convertCanonicalToReference((CanonicalType)src.getTarget())); - else - tgt.setTarget(convertType(src.getTarget())); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - - public static org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - private static class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; - - } - public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); - } - return res; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (g.hasSource()) - tgt.setSystem(g.getSource()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComments()) - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (g.hasTarget()) - tgt.setSystem(g.getTarget()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComment()) - tgt.setComments(src.getComment()); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getValue()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - 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())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); -// for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) -// tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { - CanonicalType dst = new CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private static Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { - Reference dst = new Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - 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())); - for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (CapabilityStatementRestComponent r : src.getRest()) - for (CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(convertCanonicalToReference(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; - } - } -// -// private static org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL; -// } -// } -// -// private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; -// } -// } - - public static org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; - } - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); - org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; - } - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; - } - } - - - public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.getSnapshot().addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); -// copyDomainResource(src, tgt); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// if (src.hasPublisher()) -// tgt.setPublisher(src.getPublisher()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertDataElementContactComponent(t)); -// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) -// if (t.hasValueCodeableConcept()) -// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); -// if (src.hasCopyright()) -// tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL; -// } -// } -// -// private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; -// } -// } - - public static org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - -// public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// tgt.setIdentity(src.getIdentity()); -// if (src.hasUri()) -// tgt.setUri(src.getUri()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasComment()) -// tgt.setComment(src.getComment()); -// return tgt; -// } - - public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - } - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r4.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (t.getId().equals(id)) - return t; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t.setName("Default Package"); - t.setId(id); - return t; - } - - public static org.hl7.fhir.r4.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - tgt.setUri(src.getUri()); - - if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { - tgt.setPackageId(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); - } - if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { - tgt.setVersion(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE); - tgt.setUri(src.getUri()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) { - Type t = convertType(src.getExampleFor()); - tgt.setExample(t instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); - } else if (src.hasExample()) - tgt.setExample(new org.hl7.fhir.r4.model.BooleanType(src.getExample())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) { - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - tgt.setExample(true); - } else if (src.hasExampleBooleanType()) - tgt.setExample(src.getExampleBooleanType().getValue()); - else - tgt.setExample(false); - - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setName(convertUriToUrl(src.getSourceElement())); - tgt.setTitle(src.getName()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { - switch (kind) { - case PAGE: return GuidePageGeneration.HTML; - default: return GuidePageGeneration.GENERATED; - } - } - - - private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { - switch (generation) { - case HTML: return GuidePageKind.PAGE; - default: return GuidePageKind.RESOURCE; - } - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - tgt.setName(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; - } - } - - public static org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasAffectsState()) - tgt.setIdempotent(!src.getAffectsState()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; - } - } - - public static org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.addTargetProfile(src.getProfile().getReference()); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - for (org.hl7.fhir.r4.model.UriType t : src.getTargetProfile()) - tgt.setProfile(new org.hl7.fhir.dstu2016may.model.Reference(t.getValue())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - Type t = convertType(src.getValueSet()); - if (t != null) { - if (t instanceof org.hl7.fhir.r4.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) - tgt.addExpression(convertToR4Expression(t.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getExpression()) - tgt.addExpression(convertTo2016MayExpression(t.getValue())); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; - } - } - - - public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - for (UsageContext t : src.getUseContext()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - - private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); - tgt.addInitial().setValue(convertType(src.getInitial())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasAnswered()) { - tgt.setOperator(QuestionnaireItemOperator.EXISTS); - tgt.setAnswer(convertType(src.getAnsweredElement())); - } - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) - tgt.setAnswered(src.getAnswerBooleanType().getValue()); - else - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(convertToR4Expression(src.getExpression())); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(convertTo2016MayExpression(src.getExpression())); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; - } - } - - public static org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasDisplay()) - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), src.getName())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); - } - if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setType(src.getBaseType()); - else - tgt.setType(src.getId()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) { - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.getSnapshot().getElementFirstRep().getType().clear(); - } - if (src.hasDifferential()) { - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - tgt.getDifferential().getElementFirstRep().getType().clear(); - } - if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { - for (ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + tgt.setWho(convertReference(src.getWhoReference())); + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r4.model.Address.AddressUse.NULL; } - } } - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + static public org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + } } - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasType() && src.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setBaseType(src.getType()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - private static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src, String name) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (name.substring(0, 1).toLowerCase().equals(name.substring(0,1))) - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + static public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r4.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r4.model.Address.AddressType.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + static public org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + } } - } - private static org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource140(tn)) { - return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - private static boolean isResource140(String tn) { - return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", - "Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", - "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", - "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization", - "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", - "MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", - "OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", - "Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen", - "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription"); - } - - private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL; + static public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + } } - } - public static org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap tgt = new org.hl7.fhir.r4.model.StructureMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact()) - tgt.addContact(convertStructureMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r4.model.StructureMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setMode(convertStructureMapStructureMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setMode(convertStructureMapStructureMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.PRODUCED; - case QUERIED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.QUERIED; - case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.SOURCE; - case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.TARGET; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.NULL; + static public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; + } } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED; - case QUERIED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED; - case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL; + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + } } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - tgt.setTypeMode(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (!src.getTypeMode().equals(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE)) - throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.NULL; + public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) + tgt.setSliceName(src.getName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample().get(0).getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2016may.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - tgt.setMin(src.getRequired()? 1 : 0); - if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE)) - tgt.setType(src.getContext()); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - tgt.setContextType(StructureMapContextType.TYPE); - tgt.setContext(src.getContext()); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(StructureMapListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.FIRST; - case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.LAST; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NULL; + static public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + } } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapSourceListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; - case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + } } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (Enumeration t : src.getListMode()) - tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapContextType convertStructureMapContextType(StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.NULL; + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2016may.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2016may.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0 && !e.hasFixed()) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices == 2 && existsSlicePresent && notExistsSlicePresent) || (slices == 1 && existsSlicePresent != notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r4.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(StructureMapListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.FIRST; - case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.LAST; - case SHARE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.SHARE; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.NULL; + static public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + } } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapTargetListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; - case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; - case SHARE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + } } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapTransform convertStructureMapTransform(StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPEND: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.APPEND; - case CAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CAST; - case COPY: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.COPY; - case CREATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CREATE; - case DATEOP: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.DATEOP; - case ESCAPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ESCAPE; - case EVALUATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.EVALUATE; - case POINTER: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.POINTER; - case REFERENCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.REFERENCE; - case TRANSLATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRANSLATE; - case TRUNCATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRUNCATE; - case UUID: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.UUID; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.NULL; + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r4.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPEND: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND; - case CAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST; - case COPY: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY; - case CREATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE; - case DATEOP: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP; - case ESCAPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE; - case EVALUATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE; - case POINTER: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE; - case TRANSLATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE; - case TRUNCATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE; - case UUID: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) - tgt.addVariable(t.asStringValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StringType t : src.getVariable()) - tgt.addVariable(t.asStringValue()); - return tgt; - } - - - - public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasLockedDate()) - tgt.getCompose().setLockedDate(src.getLockedDate()); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.getCompose().hasLockedDate()) - tgt.setLockedDate(src.getCompose().getLockedDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) - tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - tgt.addInclude(convertConceptSetComponent(t)); + static public void convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { + if (src.getCode().equals("Reference")) + tgt.addTargetProfile(u.getValue()); + else + tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { + String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType) t.getValue()).getValue(); + tgt.addProfile(s); + } + } else { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); } - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + public static void convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { + tgt.addProfile(u.getValue()); + String baseName = u.getValue().toLowerCase(); + if (baseName.contains("reference") && !baseName.contains("documentreference")) + throw new Error("2016May Target profile contains the word 'reference':" + u); + } + for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { + if (src.getCode().equals("Reference")) { + org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); + t.setValue(convertType(u)); + tgt.addExtension(t); + } else + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } + } + for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); } - } - private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + static public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; + } } - } - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + } + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + static public org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertToR4Expression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; + } - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertTo2016MayExpression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + public static String convertToR4Expression(String oldExpression) { + String pass1 = oldExpression.replaceAll("\\$context", "%context").replaceAll("\\$resource", "%resource").replaceAll("code\\+profile", "code&profile").replaceAll("path\\+'\\.'", "path&'.'").replaceAll("fullUrl\\+resource", "fullUrl&resource"); + String pass2 = pass1; + if (pass1.endsWith(".distinct()")) + pass2 = pass1.substring(0, pass2.length() - 11) + ".isDistinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() = 1)")) + pass3 = pass2.substring(0, pass2.length() - 30) + ".empty() or (type.count() <= 1)"; + String pass4 = pass3; + if (pass3.equals("duration >= 0")) + pass4 = "duration.exists() implies duration >= 0"; + else if (pass3.equals("period >= 0")) + pass4 = "period.exists() implies period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource")) + pass4 = "fullUrl.empty() xor resource.exists()"; + return pass4; + } -/* public static org.hl7.fhir.r4.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { + public static String convertTo2016MayExpression(String newExpression) { + String pass1 = newExpression.replaceAll("%context", "\\$context").replaceAll("%resource", "\\$resource").replaceAll("code&profile", "code+profile").replaceAll("path&'\\.'", "path+'.'").replaceAll("fullUrl%resource", "fullUrl+resource"); + String pass2 = pass1; + if (pass1.endsWith(".isDistinct()")) + pass2 = pass1.substring(0, pass1.length() - 13) + ".distinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() <= 1)")) + pass3 = pass2.substring(0, pass2.length() - 31) + ".empty() or (type.count() = 1)"; + String pass4 = pass3; + if (pass3.equals("duration.exists() implies duration >= 0")) + pass4 = "duration >= 0"; + else if (pass3.equals("period.exists() implies period >= 0")) + pass4 = "period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource.exists()")) + pass4 = "fullUrl.empty() xor resource"; + return pass4; + } + + static public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + org.hl7.fhir.r4.model.Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r4.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + tgt.addWhen(convertEventTiming(src.getWhen())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.r4.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r4.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r4.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r4.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r4.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r4.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r4.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) + return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) + return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) + return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) + return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) + return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) + return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) + return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) + return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Age) + return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) + return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Count) + return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) + return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) + return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Money) + return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Period) + return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Range) + return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) + return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) + return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Address) + return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) + return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) + return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r4.model.BooleanType) + return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r4.model.CodeType) + return convertCode((org.hl7.fhir.r4.model.CodeType) src); + if (src instanceof org.hl7.fhir.r4.model.DateType) + return convertDate((org.hl7.fhir.r4.model.DateType) src); + if (src instanceof org.hl7.fhir.r4.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r4.model.DecimalType) + return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r4.model.IdType) + return convertId((org.hl7.fhir.r4.model.IdType) src); + if (src instanceof org.hl7.fhir.r4.model.InstantType) + return convertInstant((org.hl7.fhir.r4.model.InstantType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r4.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r4.model.OidType) + return convertOid((org.hl7.fhir.r4.model.OidType) src); + if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return convertString((org.hl7.fhir.r4.model.StringType) src); + if (src instanceof org.hl7.fhir.r4.model.TimeType) + return convertTime((org.hl7.fhir.r4.model.TimeType) src); + if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) + return convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.UuidType) + return convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.Extension) + return convertExtension((org.hl7.fhir.r4.model.Extension) src); + if (src instanceof org.hl7.fhir.r4.model.Narrative) + return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); + if (src instanceof org.hl7.fhir.r4.model.Age) + return convertAge((org.hl7.fhir.r4.model.Age) src); + if (src instanceof org.hl7.fhir.r4.model.Annotation) + return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); + if (src instanceof org.hl7.fhir.r4.model.Attachment) + return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); + if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r4.model.Coding) + return convertCoding((org.hl7.fhir.r4.model.Coding) src); + if (src instanceof org.hl7.fhir.r4.model.Count) + return convertCount((org.hl7.fhir.r4.model.Count) src); + if (src instanceof org.hl7.fhir.r4.model.Distance) + return convertDistance((org.hl7.fhir.r4.model.Distance) src); + if (src instanceof org.hl7.fhir.r4.model.Duration) + return convertDuration((org.hl7.fhir.r4.model.Duration) src); + if (src instanceof org.hl7.fhir.r4.model.Identifier) + return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); + if (src instanceof org.hl7.fhir.r4.model.Money) + return convertMoney((org.hl7.fhir.r4.model.Money) src); + if (src instanceof org.hl7.fhir.r4.model.Period) + return convertPeriod((org.hl7.fhir.r4.model.Period) src); + if (src instanceof org.hl7.fhir.r4.model.Quantity) + return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); + if (src instanceof org.hl7.fhir.r4.model.Range) + return convertRange((org.hl7.fhir.r4.model.Range) src); + if (src instanceof org.hl7.fhir.r4.model.Ratio) + return convertRatio((org.hl7.fhir.r4.model.Ratio) src); + if (src instanceof org.hl7.fhir.r4.model.Reference) + return convertReference((org.hl7.fhir.r4.model.Reference) src); + if (src instanceof org.hl7.fhir.r4.model.SampledData) + return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); + if (src instanceof org.hl7.fhir.r4.model.Signature) + return convertSignature((org.hl7.fhir.r4.model.Signature) src); + if (src instanceof org.hl7.fhir.r4.model.Address) + return convertAddress((org.hl7.fhir.r4.model.Address) src); + if (src instanceof org.hl7.fhir.r4.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r4.model.HumanName) + return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); + if (src instanceof org.hl7.fhir.r4.model.Meta) + return convertMeta((org.hl7.fhir.r4.model.Meta) src); + if (src instanceof org.hl7.fhir.r4.model.Timing) + return convertTiming((org.hl7.fhir.r4.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r4.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; + } + + static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; + } + } + + /* public static org.hl7.fhir.r4.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.VisionPrescription tgt = new org.hl7.fhir.r4.model.VisionPrescription(); @@ -6943,93 +2709,89 @@ public class VersionConvertor_14_40 { } } */ - public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureMap) - return convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) + public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) + return Parameters14_40.convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) + return Bundle14_40.convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) + return CodeSystem14_40.convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) + return CompartmentDefinition14_40.convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) + return ConceptMap14_40.convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) + return Conformance14_40.convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) + return DataElement14_40.convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) + return ImplementationGuide14_40.convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) + return NamingSystem14_40.convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) + return OperationDefinition14_40.convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) + return OperationOutcome14_40.convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) + return Questionnaire14_40.convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) + return QuestionnaireResponse14_40.convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) + return SearchParameter14_40.convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) + return StructureDefinition14_40.convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureMap) + return StructureMap14_40.convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) + return ValueSet14_40.convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } + throw new FHIRException("Unknown resource " + src.fhirType()); + } - public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r4.model.Parameters) - return convertParameters((org.hl7.fhir.r4.model.Parameters) src); - if (src instanceof org.hl7.fhir.r4.model.Bundle) - return convertBundle((org.hl7.fhir.r4.model.Bundle) src); - if (src instanceof org.hl7.fhir.r4.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.r4.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.r4.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.r4.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src); -// if (src instanceof org.hl7.fhir.r4.model.DataElement) -// return convertDataElement((org.hl7.fhir.r4.model.DataElement) src); - if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r4.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r4.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r4.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.StructureMap) - return convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src); - if (src instanceof org.hl7.fhir.r4.model.ValueSet) - return convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.r4.model.VisionPrescription) + public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r4.model.Parameters) + return Parameters14_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src); + if (src instanceof org.hl7.fhir.r4.model.Bundle) + return Bundle14_40.convertBundle((org.hl7.fhir.r4.model.Bundle) src); + if (src instanceof org.hl7.fhir.r4.model.CodeSystem) + return CodeSystem14_40.convertCodeSystem((org.hl7.fhir.r4.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r4.model.CompartmentDefinition) + return CompartmentDefinition14_40.convertCompartmentDefinition((org.hl7.fhir.r4.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.ConceptMap) + return ConceptMap14_40.convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) + return Conformance14_40.convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) + return ImplementationGuide14_40.convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r4.model.NamingSystem) + return NamingSystem14_40.convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) + return OperationDefinition14_40.convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) + return OperationOutcome14_40.convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r4.model.Questionnaire) + return Questionnaire14_40.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) + return QuestionnaireResponse14_40.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r4.model.SearchParameter) + return SearchParameter14_40.convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) + return StructureDefinition14_40.convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.StructureMap) + return StructureMap14_40.convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r4.model.ValueSet) + return ValueSet14_40.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.r4.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.r4.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "StructureMap", "ValueSet"); - } - + throw new FHIRException("Unknown resource " + src.fhirType()); + } + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "StructureMap", "ValueSet"); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java index 1eadd0336..0941adf60 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java @@ -19,8 +19,6 @@ package org.hl7.fhir.convertors; * limitations under the License. * #L% */ - - /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -50,6802 +48,2548 @@ package org.hl7.fhir.convertors; */ -// Generated on Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 +import org.hl7.fhir.convertors.conv14_50.*; +import org.hl7.fhir.dstu2016may.model.CodeableConcept; +import org.hl7.fhir.dstu2016may.model.Reference; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Timing.EventTiming; +import org.hl7.fhir.utilities.Utilities; import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; -import org.hl7.fhir.dstu2016may.model.CodeableConcept; -import org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind; -import org.hl7.fhir.dstu2016may.model.Reference; -import org.hl7.fhir.dstu2016may.model.StructureMap; -import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType; -import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r5.conformance.ProfileUtilities; -import org.hl7.fhir.r5.model.BooleanType; -import org.hl7.fhir.r5.model.CanonicalType; -import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; -import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; -import org.hl7.fhir.r5.model.CodeSystem; -import org.hl7.fhir.r5.model.CodeType; -import org.hl7.fhir.r5.model.Enumerations; -import org.hl7.fhir.r5.model.Enumerations.FilterOperator; -import org.hl7.fhir.r5.model.Enumerations.ResourceTypeEnum; -import org.hl7.fhir.r5.model.ConceptMap; -import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; -import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.r5.model.ContactDetail; -import org.hl7.fhir.r5.model.ElementDefinition; -import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.r5.model.Enumeration; -import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; -import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; -import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.r5.model.Timing.EventTiming; -import org.hl7.fhir.r5.model.DataType; -import org.hl7.fhir.r5.model.UsageContext; -import org.hl7.fhir.utilities.Utilities; - public class VersionConvertor_14_50 { - private static List CANONICAL_URLS = new ArrayList(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } - - private static boolean mappedExtension(String url) { - if ( - url.equals(VersionConvertorConstants.PROFILE_EXTENSION) || - url.equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || - url.equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION) || - url.equals(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT) - ) - return true; - return false; - } - - private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && !mappedExtension(e.getUrl().toString())) - tgt.addExtension(convertExtension(e)); + static public List CANONICAL_URLS = new ArrayList(); + + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { - if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { - tgt.addExtension(convertExtension(e)); - } + static public boolean mappedExtension(String url) { + if (url.equals(VersionConvertorConstants.PROFILE_EXTENSION) || url.equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || url.equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION) || url.equals(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) + return true; + return false; } - } - private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { - org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { - org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { - org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { - org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2016may.model.Reference) - tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; - } - } - - public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(Long.valueOf(src.getSize())); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(Math.toIntExact(src.getSize())); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCode()) - tgt.setCurrency(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCurrency()) - tgt.setCode(src.getCurrency()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; - } - } - - - public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; - } - } - - public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - if (src.hasContentType()) - tgt.setSigFormat(src.getContentType()); - if (src.hasBlob()) - tgt.setData(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasSigFormat()) - tgt.setContentType(src.getSigFormat()); - if (src.hasData()) - tgt.setBlob(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r5.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; - } - } - - public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; - } - } - - public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasName()) - tgt.setSliceName(src.getName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExample().get(0).getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu2016may.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - org.hl7.fhir.dstu2016may.model.ElementDefinition slicingElement = context.get(pos); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) { - boolean isExists = false; - if (!t.asStringValue().contains("@")) { - int slices = 0; - boolean existsSlicePresent = false; - boolean notExistsSlicePresent = false; - String existsPath = slicingElement.getPath() + "." + t.asStringValue(); - for (int i = pos + 1; i < context.size(); i++) { - org.hl7.fhir.dstu2016may.model.ElementDefinition e = context.get(i); - if (e.getPath().equals(slicingElement.getPath())) - slices++; - else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) - break; - else if (e.getPath().equals(existsPath)) { - if (e.hasMin() && e.getMin() > 0 && !e.hasFixed()) - existsSlicePresent = true; - else if (e.hasMax() && e.getMax().equals("0")) - notExistsSlicePresent = true; - } + static public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && !mappedExtension(e.getUrl().toString())) + tgt.addExtension(convertExtension(e)); } - isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); - } - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); } - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + static public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) { + tgt.addExtension(convertExtension(e)); + } + } } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - } - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - static void convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); + static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - if (tgt.hasTarget()) { - for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { - // We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name. - if (src.getCode().equals("Reference")) - tgt.addTargetProfile(u.getValue()); + + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2016may.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(Long.valueOf(src.getSize())); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(Math.toIntExact(src.getSize())); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); else - tgt.addProfile(u.getValue()); - } - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { - // We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name. - String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType)t.getValue()).getValue(); - tgt.addProfile(s); - } - } else { - for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) - tgt.addProfile(u.getValue()); + tgt.setWho(convertReference(src.getWhoReference())); + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; } - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); + + public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - - public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - list.add(tgt); - if (src.hasTarget()) { - for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { - org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); - t.setValue(convertType(u)); - tgt.addExtension(t); - } - for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { - if (!u.equals(src.getTargetProfile().get(0))) { - tgt = tgt.copy(); - tgt.getProfile().clear(); - list.add(tgt); + + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r5.model.Address.AddressUse.NULL; } - tgt.addProfile(u.getValue()); - } - } else { - for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { - tgt.addProfile(u.getValue()); - } } - for (org.hl7.fhir.r5.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregationElement().setValue(a)); + + static public org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + } } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - private static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + static public org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + static public org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + } } - } - private static org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(convertToR4Expression(src.getExpression())); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(convertTo2016MayExpression(src.getExpression())); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static String convertToR4Expression(String oldExpression) { - String pass1 = oldExpression.replaceAll("\\$context","%context").replaceAll("\\$resource", "%resource").replaceAll("code\\+profile", "code&profile").replaceAll("path\\+'\\.'", "path&'.'").replaceAll("fullUrl\\+resource", "fullUrl&resource"); - String pass2 = pass1; - if (pass1.endsWith(".distinct()")) - pass2 = pass1.substring(0, pass2.length() - 11) + ".isDistinct()"; - String pass3 = pass2; - if (pass2.endsWith(".empty() or (type.count() = 1)")) - pass3 = pass2.substring(0, pass2.length() - 30) + ".empty() or (type.count() <= 1)"; - String pass4 = pass3; - if (pass3.equals("duration >= 0")) - pass4 = "duration.exists() implies duration >= 0"; - else if (pass3.equals("period >= 0")) - pass4 = "period.exists() implies period >= 0"; - else if (pass3.equals("fullUrl.empty() xor resource")) - pass4 = "fullUrl.empty() xor resource.exists()"; - return pass4; - } - - public static String convertTo2016MayExpression(String newExpression) { - String pass1 = newExpression.replaceAll("%context","\\$context").replaceAll("%resource", "\\$resource").replaceAll("code&profile", "code+profile").replaceAll("path&'\\.'", "path+'.'").replaceAll("fullUrl%resource", "fullUrl+resource"); - String pass2 = pass1; - if (pass1.endsWith(".isDistinct()")) - pass2 = pass1.substring(0, pass1.length() - 13) + ".distinct()"; - String pass3 = pass2; - if (pass2.endsWith(".empty() or (type.count() <= 1)")) - pass3 = pass2.substring(0, pass2.length() - 31) + ".empty() or (type.count() = 1)"; - String pass4 = pass3; - if (pass3.equals("duration.exists() implies duration >= 0")) - pass4 = "duration >= 0"; - else if (pass3.equals("period.exists() implies period >= 0")) - pass4 = "period >= 0"; - else if (pass3.equals("fullUrl.empty() xor resource.exists()")) - pass4 = "fullUrl.empty() xor resource"; - return pass4; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + static public org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + } } - } - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - org.hl7.fhir.r5.model.DataType t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r5.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + static public org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } } - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + static public org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + } } - return tgt; - } - private static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasName()) + tgt.setSliceName(src.getName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample().get(0).getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2016may.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; } - } - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + static public org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + } } - } - public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r5.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - tgt.addWhen(convertEventTiming(src.getWhen())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2016may.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2016may.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0 && !e.hasFixed()) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices == 2 && existsSlicePresent && notExistsSlicePresent) || (slices == 1 && existsSlicePresent != notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; } - } - private static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + static public org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + } } - } - public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) - return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) - return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) - return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) - return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) - return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) - return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) - return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) - return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Age) - return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) - return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Count) - return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) - return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) - return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Money) - return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Period) - return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Range) - return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) - return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) - return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Address) - return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) - return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) - return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r5.model.BooleanType) - return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r5.model.CodeType) - return convertCode((org.hl7.fhir.r5.model.CodeType) src); - if (src instanceof org.hl7.fhir.r5.model.DateType) - return convertDate((org.hl7.fhir.r5.model.DateType) src); - if (src instanceof org.hl7.fhir.r5.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r5.model.DecimalType) - return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r5.model.IdType) - return convertId((org.hl7.fhir.r5.model.IdType) src); - if (src instanceof org.hl7.fhir.r5.model.InstantType) - return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r5.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r5.model.OidType) - return convertOid((org.hl7.fhir.r5.model.OidType) src); - if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r5.model.StringType) - return convertString((org.hl7.fhir.r5.model.StringType) src); - if (src instanceof org.hl7.fhir.r5.model.TimeType) - return convertTime((org.hl7.fhir.r5.model.TimeType) src); - if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r5.model.UriType) - return convertUri((org.hl7.fhir.r5.model.UriType) src); - if (src instanceof org.hl7.fhir.r5.model.UuidType) - return convertUuid((org.hl7.fhir.r5.model.UuidType) src); - if (src instanceof org.hl7.fhir.r5.model.Extension) - return convertExtension((org.hl7.fhir.r5.model.Extension) src); - if (src instanceof org.hl7.fhir.r5.model.Narrative) - return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); - if (src instanceof org.hl7.fhir.r5.model.Age) - return convertAge((org.hl7.fhir.r5.model.Age) src); - if (src instanceof org.hl7.fhir.r5.model.Annotation) - return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); - if (src instanceof org.hl7.fhir.r5.model.Attachment) - return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); - if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r5.model.Coding) - return convertCoding((org.hl7.fhir.r5.model.Coding) src); - if (src instanceof org.hl7.fhir.r5.model.Count) - return convertCount((org.hl7.fhir.r5.model.Count) src); - if (src instanceof org.hl7.fhir.r5.model.Distance) - return convertDistance((org.hl7.fhir.r5.model.Distance) src); - if (src instanceof org.hl7.fhir.r5.model.Duration) - return convertDuration((org.hl7.fhir.r5.model.Duration) src); - if (src instanceof org.hl7.fhir.r5.model.Identifier) - return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); - if (src instanceof org.hl7.fhir.r5.model.Money) - return convertMoney((org.hl7.fhir.r5.model.Money) src); - if (src instanceof org.hl7.fhir.r5.model.Period) - return convertPeriod((org.hl7.fhir.r5.model.Period) src); - if (src instanceof org.hl7.fhir.r5.model.Quantity) - return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); - if (src instanceof org.hl7.fhir.r5.model.Range) - return convertRange((org.hl7.fhir.r5.model.Range) src); - if (src instanceof org.hl7.fhir.r5.model.Ratio) - return convertRatio((org.hl7.fhir.r5.model.Ratio) src); - if (src instanceof org.hl7.fhir.r5.model.Reference) - return convertReference((org.hl7.fhir.r5.model.Reference) src); - if (src instanceof org.hl7.fhir.r5.model.SampledData) - return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); - if (src instanceof org.hl7.fhir.r5.model.Signature) - return convertSignature((org.hl7.fhir.r5.model.Signature) src); - if (src instanceof org.hl7.fhir.r5.model.Address) - return convertAddress((org.hl7.fhir.r5.model.Address) src); - if (src instanceof org.hl7.fhir.r5.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r5.model.HumanName) - return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); - if (src instanceof org.hl7.fhir.r5.model.Meta) - return convertMeta((org.hl7.fhir.r5.model.Meta) src); - if (src instanceof org.hl7.fhir.r5.model.Timing) - return convertTiming((org.hl7.fhir.r5.model.Timing) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - private static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r5.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) - if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t)); - } - public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - - public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; } - } - public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + static public void convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { + if (src.getCode().equals("Reference")) + tgt.addTargetProfile(u.getValue()); + else + tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { + String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType) t.getValue()).getValue(); + tgt.addProfile(s); + } + } else { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); } - } - private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; - } - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; - } - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLAR: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; - case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) - try { - tgt.addOperator(Enumerations.FilterOperator.fromCode(t.getValue())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (Enumeration t : src.getOperator()) - tgt.addOperator(t.getValue().toCode()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (ConceptDefinitionPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; - default: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.r5.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasCode()) { - tgt.setCode(src.getCode()); - } - for (org.hl7.fhir.r5.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - - public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - org.hl7.fhir.r5.model.DataType tt = convertType(src.getSource()); - tgt.setSource(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); - tt = convertType(src.getTarget()); - tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) { - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - } - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.getSource() instanceof CanonicalType) - tgt.setSource(convertCanonicalToReference((CanonicalType)src.getSource())); - else - tgt.setSource(convertType(src.getSource())); - if (src.getTarget() instanceof CanonicalType) - tgt.setTarget(convertCanonicalToReference((CanonicalType)src.getTarget())); - else - tgt.setTarget(convertType(src.getTarget())); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - - public static org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - private static class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; - - } - public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) + public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); tgt.setCode(src.getCode()); - if (t.getEquivalence() == org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { - tgt.setNoMap(true); - } else { - tgt.addTarget(convertTargetElementComponent(t)); - } - res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); - } - return res; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (g.hasSource()) - tgt.setSystem(g.getSource()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasNoMap() && src.getNoMap() == true) { - tgt.addTarget(new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); - } - else { - for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); - if (src.hasComments()) - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (g.hasTarget()) - tgt.setSystem(g.getTarget()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); - if (src.hasComment()) - tgt.setComments(src.getComment()); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; - case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; - default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case BROADER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; - case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; - case NOTRELATEDTO: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getValue()); - return tgt; - } - - - public static org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - 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())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); -// for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) -// tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { - CanonicalType dst = new CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private static Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { - Reference dst = new Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - 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())); - for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (CapabilityStatementRestComponent r : src.getRest()) - for (CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(convertCanonicalToReference(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; - } - } -// -// private static org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; -// } -// } -// -// private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; -// } -// } - - public static org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; - } - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) { - tgt.setType(src.getType()); - } - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); - org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; - } - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; - } - } - - - public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.getSnapshot().addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); -// copyDomainResource(src, tgt); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// if (src.hasPublisher()) -// tgt.setPublisher(src.getPublisher()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertDataElementContactComponent(t)); -// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) -// if (t.hasValueCodeableConcept()) -// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); -// if (src.hasCopyright()) -// tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; -// } -// } -// -// private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; -// } -// } - - public static org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - -// public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// tgt.setIdentity(src.getIdentity()); -// if (src.hasUri()) -// tgt.setUri(src.getUri()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasComment()) -// tgt.setComment(src.getComment()); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - } - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (t.getId().equals(id)) - return t; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t.setName("Default Package"); - t.setId(id); - return t; - } - - public static org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - tgt.setUri(src.getUri()); - - if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { - tgt.setPackageId(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); - } - if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { - tgt.setVersion(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE); - tgt.setUri(src.getUri()); - if (src.hasPackageId()) - tgt.addExtension(new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION, new org.hl7.fhir.dstu2016may.model.IdType(src.getPackageId()))); - if (src.hasVersion()) - tgt.addExtension(new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION, new org.hl7.fhir.dstu2016may.model.StringType(src.getVersion()))); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) { - DataType t = convertType(src.getExampleFor()); - tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); - } else if (src.hasExample()) - tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) { - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - tgt.setExample(true); - } else if (src.hasExampleBooleanType()) - tgt.setExample(src.getExampleBooleanType().getValue()); - else - tgt.setExample(false); - - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (tgt.hasType()) { - tgt.setType(src.getType()); - } - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setName(convertUriToUrl(src.getSourceElement())); - tgt.setTitle(src.getName()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { - switch (kind) { - case PAGE: return GuidePageGeneration.HTML; - default: return GuidePageGeneration.GENERATED; - } - } - - - private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { - switch (generation) { - case HTML: return GuidePageKind.PAGE; - default: return GuidePageKind.RESOURCE; - } - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - tgt.setName(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; - } - } - - public static org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasAffectsState()) - tgt.setIdempotent(!src.getAffectsState()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; - } - } - - public static org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.addTargetProfile(src.getProfile().getReference()); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) { - tgt.setType(src.getType().toCode()); - } - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) - tgt.setProfile(new org.hl7.fhir.dstu2016may.model.Reference(t.getValue())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; - default: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - DataType t = convertType(src.getValueSet()); - if (t != null) { - if (t instanceof org.hl7.fhir.r5.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) - tgt.addExpression(convertToR4Expression(t.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) - tgt.addExpression(convertTo2016MayExpression(t.getValue())); - return tgt; - } - - private static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; - } - } - - - public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addContact(convertQuestionnaireContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (ContactDetail t : src.getContact()) - for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) - tgt.addTelecom(convertContactPoint(t1)); - for (UsageContext t : src.getUseContext()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - for (CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - tgt.addTelecom(convertContactPoint(src)); - return tgt; - } - - - private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); - tgt.addInitial().setValue(convertType(src.getInitial())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; - case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; -// case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasAnswered()) { - tgt.setOperator(QuestionnaireItemOperator.EXISTS); - tgt.setAnswer(convertType(src.getAnsweredElement())); - } - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) - tgt.setAnswered(src.getAnswerBooleanType().getValue()); - else - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(convertToR4Expression(src.getExpression())); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(convertTo2016MayExpression(src.getExpression())); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; - } - } - - public static org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasDisplay()) - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), src.getName())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); - } - if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setType(src.getBaseType()); - else - tgt.setType(src.getId()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) { - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.getSnapshot().getElementFirstRep().getType().clear(); - } - if (src.hasDifferential()) { - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - tgt.getDifferential().getElementFirstRep().getType().clear(); - } - if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { - for (ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); + t.setValue(convertType(u)); + tgt.addExtension(t); + } + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + if (!u.equals(src.getTargetProfile().get(0))) { + tgt = tgt.copy(); + tgt.getProfile().clear(); + list.add(tgt); + } + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } } - } + for (org.hl7.fhir.r5.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregationElement().setValue(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); } - return tgt; - } - public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + static public org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } } - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasType() && src.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setBaseType(src.getType()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - private static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src, String name) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (name.substring(0, 1).toLowerCase().equals(name.substring(0,1))) - return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + static public org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + } } - } - private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + } } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource140(tn)) { - return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertToR4Expression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; } - } - - private static boolean isResource140(String tn) { - return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", - "Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", - "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", - "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization", - "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", - "MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", - "OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", - "Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen", - "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription"); - } - - - private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertTo2016MayExpression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + public static String convertToR4Expression(String oldExpression) { + String pass1 = oldExpression.replaceAll("\\$context", "%context").replaceAll("\\$resource", "%resource").replaceAll("code\\+profile", "code&profile").replaceAll("path\\+'\\.'", "path&'.'").replaceAll("fullUrl\\+resource", "fullUrl&resource"); + String pass2 = pass1; + if (pass1.endsWith(".distinct()")) + pass2 = pass1.substring(0, pass2.length() - 11) + ".isDistinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() = 1)")) + pass3 = pass2.substring(0, pass2.length() - 30) + ".empty() or (type.count() <= 1)"; + String pass4 = pass3; + if (pass3.equals("duration >= 0")) + pass4 = "duration.exists() implies duration >= 0"; + else if (pass3.equals("period >= 0")) + pass4 = "period.exists() implies period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource")) + pass4 = "fullUrl.empty() xor resource.exists()"; + return pass4; } - } - public static org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact()) - tgt.addContact(convertStructureMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setMode(convertStructureMapStructureMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setMode(convertStructureMapStructureMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; - case QUERIED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; - case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; - case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + public static String convertTo2016MayExpression(String newExpression) { + String pass1 = newExpression.replaceAll("%context", "\\$context").replaceAll("%resource", "\\$resource").replaceAll("code&profile", "code+profile").replaceAll("path&'\\.'", "path+'.'").replaceAll("fullUrl%resource", "fullUrl+resource"); + String pass2 = pass1; + if (pass1.endsWith(".isDistinct()")) + pass2 = pass1.substring(0, pass1.length() - 13) + ".distinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() <= 1)")) + pass3 = pass2.substring(0, pass2.length() - 31) + ".empty() or (type.count() = 1)"; + String pass4 = pass3; + if (pass3.equals("duration.exists() implies duration >= 0")) + pass4 = "duration >= 0"; + else if (pass3.equals("period.exists() implies period >= 0")) + pass4 = "period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource.exists()")) + pass4 = "fullUrl.empty() xor resource"; + return pass4; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED; - case QUERIED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED; - case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL; + static public org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - tgt.setTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (!src.getTypeMode().equals(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE)) - throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + static public org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + } } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + org.hl7.fhir.r5.model.DataType t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - tgt.setMin(src.getRequired()? 1 : 0); - if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE)) - tgt.setType(src.getContext()); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - tgt.setContextType(StructureMapContextType.TYPE); - tgt.setContext(src.getContext()); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(StructureMapListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; - case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; - case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + static public org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (Enumeration t : src.getListMode()) - tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + static public org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + } } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL; + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(StructureMapListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; - case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; - case SHARE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; - case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; - case SHARE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPEND: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; - case CAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; - case COPY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; - case CREATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; - case DATEOP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; - case ESCAPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; - case EVALUATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; - case POINTER: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; - case REFERENCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; - case TRANSLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; - case TRUNCATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; - case UUID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; } - } - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPEND: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND; - case CAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST; - case COPY: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY; - case CREATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE; - case DATEOP: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP; - case ESCAPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE; - case EVALUATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE; - case POINTER: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE; - case TRANSLATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE; - case TRUNCATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE; - case UUID: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID; - default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL; + static public org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } } - } - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) - tgt.addVariable(t.asStringValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) - tgt.addVariable(t.asStringValue()); - return tgt; - } - - - - public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasLockedDate()) - tgt.getCompose().setLockedDate(src.getLockedDate()); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.getCompose().hasLockedDate()) - tgt.setLockedDate(src.getCompose().getLockedDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) - tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - tgt.addInclude(convertConceptSetComponent(t)); + static public org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + } } - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; - default: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; } - } - private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; } - } - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + tgt.addWhen(convertEventTiming(src.getWhen())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } + public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) tgt.setWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + static public org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } + static public org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + } + } -/* public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { + static public org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HS: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) + return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) + return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) + return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) + return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) + return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) + return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) + return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) + return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Age) + return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) + return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Count) + return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) + return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) + return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Money) + return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Period) + return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Range) + return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) + return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) + return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Address) + return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) + return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) + return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t)); + } + + static public void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + static public boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); + result.setValue(convertCodeableConcept(t)); + return result; + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + + public String source; + + public String target; + + public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; + } + + static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; + } + } + + /* public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r5.model.VisionPrescription tgt = new org.hl7.fhir.r5.model.VisionPrescription(); @@ -6969,93 +2713,89 @@ public class VersionConvertor_14_50 { } } */ - public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureMap) - return convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) + return Parameters14_50.convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) + return Bundle14_50.convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) + return CodeSystem14_50.convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) + return CompartmentDefinition14_50.convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) + return ConceptMap14_50.convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) + return Conformance14_50.convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) + return DataElement14_50.convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) + return ImplementationGuide14_50.convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) + return NamingSystem14_50.convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) + return OperationDefinition14_50.convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) + return OperationOutcome14_50.convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) + return Questionnaire14_50.convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) + return QuestionnaireResponse14_50.convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) + return SearchParameter14_50.convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) + return StructureDefinition14_50.convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureMap) + return StructureMap14_50.convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) + return ValueSet14_50.convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } + throw new FHIRException("Unknown resource " + src.fhirType()); + } - public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r5.model.Parameters) - return convertParameters((org.hl7.fhir.r5.model.Parameters) src); - if (src instanceof org.hl7.fhir.r5.model.Bundle) - return convertBundle((org.hl7.fhir.r5.model.Bundle) src); - if (src instanceof org.hl7.fhir.r5.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); -// if (src instanceof org.hl7.fhir.r5.model.DataElement) -// return convertDataElement((org.hl7.fhir.r5.model.DataElement) src); - if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r5.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r5.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r5.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.StructureMap) - return convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); - if (src instanceof org.hl7.fhir.r5.model.ValueSet) - return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) + public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) + return Parameters14_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return Bundle14_50.convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CodeSystem) + return CodeSystem14_50.convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) + return CompartmentDefinition14_50.convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return ConceptMap14_50.convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return Conformance14_50.convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return ImplementationGuide14_50.convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return NamingSystem14_50.convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return OperationDefinition14_50.convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return OperationOutcome14_50.convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return Questionnaire14_50.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return QuestionnaireResponse14_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return SearchParameter14_50.convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return StructureDefinition14_50.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureMap) + return StructureMap14_50.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return ValueSet14_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); + /* if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) return convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src);*/ - throw new FHIRException("Unknown resource "+src.fhirType()); - } - - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "StructureMap", "ValueSet"); - } - + throw new FHIRException("Unknown resource " + src.fhirType()); + } + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "StructureMap", "ValueSet"); + } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java index 59016a7e3..d12f6b22b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java @@ -20,31 +20,18 @@ package org.hl7.fhir.convertors; * #L% */ - -import java.util.ArrayList; -import java.util.List; - -import org.hl7.fhir.dstu3.model.ContactDetail; -import org.hl7.fhir.dstu3.model.Contributor.ContributorType; -import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; -import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; -import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; +import org.hl7.fhir.convertors.conv30_40.*; import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.Questionnaire; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Enumeration; -import org.hl7.fhir.r4.model.Expression.ExpressionLanguage; -import org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent; -import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.TerminologyCapabilities; import org.hl7.fhir.r4.model.Type; import org.hl7.fhir.r4.model.UriType; import org.hl7.fhir.utilities.Utilities; +import java.util.ArrayList; +import java.util.List; /* Copyright (c) 2011+, HL7, Inc. @@ -74,23297 +61,4621 @@ import org.hl7.fhir.utilities.Utilities; POSSIBILITY OF SUCH DAMAGE. */ - - public class VersionConvertor_30_40 { - private static final String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"; - private static List CANONICAL_URLS = new ArrayList<>(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } - - private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { - tgt.addExtension(convertExtension(e)); - } + + static final public String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"; + + static public List CANONICAL_URLS = new ArrayList<>(); + + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - private static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { - tgt.addExtension(convertExtension(e)); - } - } - } - - private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateType convertDateTimeToDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType (src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.InstantType convertDateTimeToInstant(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu3.model.Reference) - tgt.setValue(convertReferenceToCanonical((org.hl7.fhir.dstu3.model.Reference)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((org.hl7.fhir.r4.model.CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - if (src.hasDiv()) - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - if (src.hasDiv()) - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); - copyElement(src, tgt); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - tgt.setCode(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeableConcept convertCodingToCodeableConcept(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.getCodingFirstRep().setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.getCodingFirstRep().setVersion(src.getVersion()); - if (src.hasCode()) - tgt.getCodingFirstRep().setCode(src.getCode()); - if (src.hasDisplay()) - tgt.getCodingFirstRep().setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.getCodingFirstRep().setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - if (src.hasCoding()) { - if (src.getCodingFirstRep().hasSystem()) - tgt.setSystem(src.getCodingFirstRep().getSystem()); - if (src.getCodingFirstRep().hasVersion()) - tgt.setVersion(src.getCodingFirstRep().getVersion()); - if (src.getCodingFirstRep().hasCode()) - tgt.setCode(src.getCodingFirstRep().getCode()); - if (src.getCodingFirstRep().hasDisplay()) - tgt.setDisplay(src.getCodingFirstRep().getDisplay()); - if (src.getCodingFirstRep().hasUserSelected()) - tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasCoding()) { - if (src.getCodingFirstRep().hasSystem()) - tgt.setSystem(src.getCodingFirstRep().getSystem()); - if (src.getCodingFirstRep().hasVersion()) - tgt.setVersion(src.getCodingFirstRep().getVersion()); - if (src.getCodingFirstRep().hasCode()) - tgt.setCode(src.getCodingFirstRep().getCode()); - if (src.getCodingFirstRep().hasDisplay()) - tgt.setDisplay(src.getCodingFirstRep().getDisplay()); - if (src.getCodingFirstRep().hasUserSelected()) - tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; - } -} - - public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCode()) - tgt.setCurrency(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCurrency()) - tgt.setCode(src.getCurrency()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStartElement(convertDateTime(src.getStartElement())); - if (src.hasEnd()) - tgt.setEndElement(convertDateTime(src.getEndElement())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStartElement(convertDateTime(src.getStartElement())); - if (src.hasEnd()) - tgt.setEndElement(convertDateTime(src.getEndElement())); - return tgt; - } - - public static void copyQuantity(org.hl7.fhir.dstu3.model.Quantity src, org.hl7.fhir.r4.model.Quantity tgt) throws FHIRException { - if (src == null || tgt == null) - return; - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - } - - public static void copyQuantity(org.hl7.fhir.r4.model.Quantity src, org.hl7.fhir.dstu3.model.Quantity tgt) throws FHIRException { - if (src == null || tgt == null) - return; - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); -} - - public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; - } -} - - public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); - copyElement(src, tgt); - if (src.hasNumerator()) - tgt.setNumerator(convertQuantity(src.getNumerator())); - if (src.hasDenominator()) - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - if (src.hasNumerator()) - tgt.setNumerator(convertQuantity(src.getNumerator())); - if (src.hasDenominator()) - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); - copyElement(src, tgt); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - if (src.hasDimensions()) - tgt.setDimensions(src.getDimensions()); - if (src.hasData()) - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - if (src.hasDimensions()) - tgt.setDimensions(src.getDimensions()); - if (src.hasData()) - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - if (src.hasWhen()) - tgt.setWhen(src.getWhen()); - if (src.hasWho()) { - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - } - if (src.hasOnBehalfOf()) { - if (src.hasOnBehalfOfUriType()) - tgt.setOnBehalfOf(new Reference(src.getOnBehalfOfUriType().primitiveValue())); - else - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOfReference())); - } - if (src.hasContentType()) - tgt.setSigFormat(src.getContentType()); - if (src.hasBlob()) - tgt.setData(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - if (src.hasWhen()) - tgt.setWhen(src.getWhen()); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); - if (src.hasSigFormat()) - tgt.setContentType(src.getSigFormat()); - if (src.hasData()) - tgt.setBlob(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertAddressUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertAddressUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; - } -} - - private static org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; - } -} - - public static org.hl7.fhir.r4.model.ContactDetail convertContactDetail(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertContactDetail(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasUse()) - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasUse()) - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL; - case SMS: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.SMS; - case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; - case SMS: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; - } -} - - private static org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; - } -} - - public static org.hl7.fhir.r4.model.Contributor convertContributor(org.hl7.fhir.dstu3.model.Contributor src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Contributor tgt = new org.hl7.fhir.r4.model.Contributor(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertContributorType(src.getType())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Contributor convertContributor(org.hl7.fhir.r4.model.Contributor src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Contributor tgt = new org.hl7.fhir.dstu3.model.Contributor(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertContributorType(src.getType())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.dstu3.model.Contributor.ContributorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AUTHOR: return org.hl7.fhir.r4.model.Contributor.ContributorType.AUTHOR; - case EDITOR: return org.hl7.fhir.r4.model.Contributor.ContributorType.EDITOR; - case REVIEWER: return org.hl7.fhir.r4.model.Contributor.ContributorType.REVIEWER; - case ENDORSER: return org.hl7.fhir.r4.model.Contributor.ContributorType.ENDORSER; - default: return org.hl7.fhir.r4.model.Contributor.ContributorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r4.model.Contributor.ContributorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AUTHOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.AUTHOR; - case EDITOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.EDITOR; - case REVIEWER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.REVIEWER; - case ENDORSER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.ENDORSER; - default: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.NULL; - } -} - - - public static org.hl7.fhir.r4.model.Dosage convertDosage(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - if (src.hasSequence()) - tgt.setSequence(src.getSequence()); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAdditionalInstruction()) - tgt.addAdditionalInstruction(convertCodeableConcept(t)); - if (src.hasPatientInstruction()) - tgt.setPatientInstruction(src.getPatientInstruction()); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasMaxDosePerAdministration()) - tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); - if (src.hasMaxDosePerLifetime()) - tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Dosage convertDosage(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - if (src.hasSequence()) - tgt.setSequence(src.getSequence()); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAdditionalInstruction()) - tgt.addAdditionalInstruction(convertCodeableConcept(t)); - if (src.hasPatientInstruction()) - tgt.setPatientInstruction(src.getPatientInstruction()); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) { - // We need to manually make sure that the convertSimpleQuantity method is - // called. Otherwise (if we would simply forward to the convertType method), this would lead - // to a conversion to another Quantity object, that would be invalid for the DSTU3 Dosage resource. - if (src.getDoseAndRate().get(0).getDose() instanceof org.hl7.fhir.r4.model.Quantity) { - tgt.setDose(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getDose())); - } else { - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - } - } - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasMaxDosePerAdministration()) - tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); - if (src.hasMaxDosePerLifetime()) - tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) { - // We need to manually make sure that the convertSimpleQuantity method is - // called. Otherwise (if we would simply forward to the convertType method), this would lead - // to a conversion to another Quantity object, that would be invalid for the DSTU3 Dosage resource. - if (src.getDoseAndRate().get(0).getRate() instanceof org.hl7.fhir.r4.model.Quantity) { - tgt.setRate(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getRate())); - } else { - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - } - } - return tgt; - } - - public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasOrderMeaning()) - tgt.setOrderMeaning(src.getOrderMeaning()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) - tgt.addExample(convertElementDefinitionExampleComponent(t)); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasOrderMeaning()) - tgt.setOrderMeaning(src.getOrderMeaning()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) - tgt.addExample(convertElementDefinitionExampleComponent(t)); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu3.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT; - case XHTML: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XHTML; - default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; - case XHTML: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XHTML; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - if (src.hasRules()) - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - if (src.hasRules()) - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertDiscriminatorType(src.getType())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertDiscriminatorType(src.getType())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VALUE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.VALUE; - case EXISTS: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.EXISTS; - case PATTERN: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PATTERN; - case TYPE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.TYPE; - case PROFILE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PROFILE; - default: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VALUE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.VALUE; - case EXISTS: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.EXISTS; - case PATTERN: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PATTERN; - case TYPE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.TYPE; - case PROFILE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PROFILE; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCodeElement(convertUri(src.getCodeElement())); - } - if (src.hasProfile()) - tgt.addProfile(src.getProfile()); - if (src.hasTargetProfile()) - tgt.addTargetProfile(src.getTargetProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); - } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - - public static void convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertUri(src.getCodeElement())); - list.add(tgt); - if (src.hasTarget()) { - if (src.hasProfile()) - tgt.setProfile(src.getProfile().get(0).getValue()); - for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { - if (tgt.hasTargetProfile()) { - tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile().get(0).getValue()); + static public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... extensionsToIgnore) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { + tgt.addExtension(convertExtension(e)); + } } - tgt.setTargetProfile(u.getValue()); - } - } else { - for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { - if (tgt.hasProfile()) { - tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); + } + + static public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... extensionsToIgnore) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { + tgt.addExtension(convertExtension(e)); + } } - tgt.setProfile(u.getValue()); - } } - } - private static org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; - } -} - - private static org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - if (src.hasKey()) - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - if (src.hasSeverity()) - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - if (src.hasHuman()) - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasSource()) - tgt.setSource(src.getSource()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - if (src.hasKey()) - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - if (src.hasSeverity()) - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - if (src.hasHuman()) - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasSource()) - tgt.setSource(src.getSource()); - return tgt; - } - - private static org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt, EXT_SRC_TYPE); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - Type t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r4.model.Reference) { - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("Reference")); - } else { - tgt.setValueSet(t.primitiveValue()); - tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("uri")); - } - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - return tgt; - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt, EXT_SRC_TYPE); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - org.hl7.fhir.r4.model.Extension ex = src.getValueSetElement().getExtensionByUrl(EXT_SRC_TYPE); - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (ex != null) { - if ("uri".equals(ex.getValue().primitiveValue())) { - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr == null ? src.getValueSet() : vsr)); + static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDateTimeToDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu3.model.Reference) + tgt.setValue(convertReferenceToCanonical((org.hl7.fhir.dstu3.model.Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((org.hl7.fhir.r4.model.CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + tgt.setCode(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + return tgt; + } + + public static void copyQuantity(org.hl7.fhir.dstu3.model.Quantity src, org.hl7.fhir.r4.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static void copyQuantity(org.hl7.fhir.r4.model.Quantity src, org.hl7.fhir.dstu3.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) { + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r4.model.Reference(src.getWhoUriType().getValue())); + else + tgt.setWho(convertReference(src.getWhoReference())); + } + if (src.hasOnBehalfOf()) { + if (src.hasOnBehalfOfUriType()) + tgt.setOnBehalfOf(new Reference(src.getOnBehalfOfUriType().primitiveValue())); + else + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOfReference())); + } + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r4.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r4.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r4.model.Address.AddressType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.r4.model.ContactDetail convertContactDetail(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertContactDetail(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL; + case SMS: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; + case SMS: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Contributor convertContributor(org.hl7.fhir.dstu3.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contributor tgt = new org.hl7.fhir.r4.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contributor convertContributor(org.hl7.fhir.r4.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Contributor tgt = new org.hl7.fhir.dstu3.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.dstu3.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AUTHOR: + return org.hl7.fhir.r4.model.Contributor.ContributorType.AUTHOR; + case EDITOR: + return org.hl7.fhir.r4.model.Contributor.ContributorType.EDITOR; + case REVIEWER: + return org.hl7.fhir.r4.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: + return org.hl7.fhir.r4.model.Contributor.ContributorType.ENDORSER; + default: + return org.hl7.fhir.r4.model.Contributor.ContributorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r4.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AUTHOR: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.AUTHOR; + case EDITOR: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.EDITOR; + case REVIEWER: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.ENDORSER; + default: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Dosage convertDosage(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAdditionalInstruction()) tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertDosage(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAdditionalInstruction()) tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) { + if (src.getDoseAndRate().get(0).getDose() instanceof org.hl7.fhir.r4.model.Quantity) { + tgt.setDose(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getDose())); + } else { + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + } + } + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) { + if (src.getDoseAndRate().get(0).getRate() instanceof org.hl7.fhir.r4.model.Quantity) { + tgt.setRate(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getRate())); + } else { + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + } + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu3.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XHTML; + default: + return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XHTML; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + static public org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VALUE: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PROFILE; + default: + return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VALUE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PROFILE; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + } + if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + if (src.hasTargetProfile()) + tgt.addTargetProfile(src.getTargetProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r4.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + } + + public static void convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + list.add(tgt); + if (src.hasTarget()) { + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) { + if (tgt.hasTargetProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + } + tgt.setTargetProfile(u.getValue()); + } } else { - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) { + if (tgt.hasProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + tgt.setProfile(u.getValue()); + } } - } else { - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + } + + static public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + static public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt, EXT_SRC_TYPE); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r4.model.Reference) { + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("Reference")); + } else { + tgt.setValueSet(t.primitiveValue()); + tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("uri")); + } + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt, EXT_SRC_TYPE); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + org.hl7.fhir.r4.model.Extension ex = src.getValueSetElement().getExtensionByUrl(EXT_SRC_TYPE); + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (ex != null) { + if ("uri".equals(ex.getValue().primitiveValue())) { + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr == null ? src.getValueSet() : vsr)); + } else { + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + } else { + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + } + return tgt; + } + + static public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); + for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ParameterDefinition tgt = new org.hl7.fhir.r4.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) { + tgt.setProfile(convertReference(src.getProfile()).getReference()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.IN; + case OUT: + return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.OUT; + default: + return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RelatedArtifact tgt = new org.hl7.fhir.r4.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResourceElement(convertReferenceToCanonical(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RelatedArtifact tgt = new org.hl7.fhir.dstu3.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResource(convertCanonicalToReference(src.getResourceElement())); + return tgt; + } + + static public org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENTATION: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: + return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENTATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDayOfWeek()) copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); + for (org.hl7.fhir.dstu3.model.TimeType t : src.getTimeOfDay()) tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getWhen()) copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDayOfWeek()) copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); + for (org.hl7.fhir.r4.model.TimeType t : src.getTimeOfDay()) tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getWhen()) copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.r4.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.dstu3.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.MON; + case TUE: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.TUE; + case WED: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.WED; + case THU: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.THU; + case FRI: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.FRI; + case SAT: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.SAT; + case SUN: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.SUN; + default: + return org.hl7.fhir.r4.model.Timing.DayOfWeek.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r4.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.NULL; + } + } + + static public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MORN: + return org.hl7.fhir.r4.model.Timing.EventTiming.MORN; + case AFT: + return org.hl7.fhir.r4.model.Timing.EventTiming.AFT; + case EVE: + return org.hl7.fhir.r4.model.Timing.EventTiming.EVE; + case NIGHT: + return org.hl7.fhir.r4.model.Timing.EventTiming.NIGHT; + case PHS: + return org.hl7.fhir.r4.model.Timing.EventTiming.PHS; + case HS: + return org.hl7.fhir.r4.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r4.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r4.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r4.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r4.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r4.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r4.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MORN: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.MORN; + case AFT: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AFT; + case EVE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.EVE; + case NIGHT: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NIGHT; + case PHS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PHS; + case HS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r4.model.UsageContext convertUsageContext(org.hl7.fhir.dstu3.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.UsageContext tgt = new org.hl7.fhir.r4.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UsageContext convertUsageContext(org.hl7.fhir.r4.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.UsageContext tgt = new org.hl7.fhir.dstu3.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.dstu3.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TriggerDefinition tgt = new org.hl7.fhir.r4.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasEventName()) + tgt.setName(src.getEventName()); + if (src.hasEventTiming()) + tgt.setTiming(convertType(src.getEventTiming())); + if (src.hasEventData()) + tgt.addData(convertDataRequirement(src.getEventData())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r4.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TriggerDefinition tgt = new org.hl7.fhir.dstu3.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasName()) + tgt.setEventName(src.getName()); + if (src.hasTiming()) + tgt.setEventTiming(convertType(src.getTiming())); + if (src.hasData()) + tgt.setEventData(convertDataRequirement(src.getDataFirstRep())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement convertDataRequirement(org.hl7.fhir.dstu3.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getMustSupport()) tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement convertDataRequirement(org.hl7.fhir.r4.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement tgt = new org.hl7.fhir.dstu3.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getMustSupport()) tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r4.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + for (org.hl7.fhir.dstu3.model.CodeType t : src.getValueCode()) tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getValueCoding()) tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getValueCodeableConcept()) tgt.addCode(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) { + tgt.addValueCoding(convertCoding(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r4.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NAMEDEVENT: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: + return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r4.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NAMEDEVENT: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.Contributor) + return convertContributor((org.hl7.fhir.dstu3.model.Contributor) src); + if (src instanceof org.hl7.fhir.dstu3.model.Dosage) + return convertDosage((org.hl7.fhir.dstu3.model.Dosage) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.dstu3.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.dstu3.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu3.model.UsageContext) + return convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.dstu3.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.dstu3.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.dstu3.model.TriggerDefinition) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r4.model.BooleanType) + return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r4.model.CodeType) + return convertCode((org.hl7.fhir.r4.model.CodeType) src); + if (src instanceof org.hl7.fhir.r4.model.DateType) + return convertDate((org.hl7.fhir.r4.model.DateType) src); + if (src instanceof org.hl7.fhir.r4.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r4.model.DecimalType) + return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r4.model.IdType) + return convertId((org.hl7.fhir.r4.model.IdType) src); + if (src instanceof org.hl7.fhir.r4.model.InstantType) + return convertInstant((org.hl7.fhir.r4.model.InstantType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r4.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r4.model.OidType) + return convertOid((org.hl7.fhir.r4.model.OidType) src); + if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return convertString((org.hl7.fhir.r4.model.StringType) src); + if (src instanceof org.hl7.fhir.r4.model.TimeType) + return convertTime((org.hl7.fhir.r4.model.TimeType) src); + if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) + return convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.UuidType) + return convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.Extension) + return convertExtension((org.hl7.fhir.r4.model.Extension) src); + if (src instanceof org.hl7.fhir.r4.model.Narrative) + return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); + if (src instanceof org.hl7.fhir.r4.model.Age) + return convertAge((org.hl7.fhir.r4.model.Age) src); + if (src instanceof org.hl7.fhir.r4.model.Annotation) + return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); + if (src instanceof org.hl7.fhir.r4.model.Attachment) + return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); + if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r4.model.Coding) + return convertCoding((org.hl7.fhir.r4.model.Coding) src); + if (src instanceof org.hl7.fhir.r4.model.Count) + return convertCount((org.hl7.fhir.r4.model.Count) src); + if (src instanceof org.hl7.fhir.r4.model.Distance) + return convertDistance((org.hl7.fhir.r4.model.Distance) src); + if (src instanceof org.hl7.fhir.r4.model.Duration) + return convertDuration((org.hl7.fhir.r4.model.Duration) src); + if (src instanceof org.hl7.fhir.r4.model.Identifier) + return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); + if (src instanceof org.hl7.fhir.r4.model.Money) + return convertMoney((org.hl7.fhir.r4.model.Money) src); + if (src instanceof org.hl7.fhir.r4.model.Period) + return convertPeriod((org.hl7.fhir.r4.model.Period) src); + if (src instanceof org.hl7.fhir.r4.model.Quantity) + return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); + if (src instanceof org.hl7.fhir.r4.model.Range) + return convertRange((org.hl7.fhir.r4.model.Range) src); + if (src instanceof org.hl7.fhir.r4.model.Ratio) + return convertRatio((org.hl7.fhir.r4.model.Ratio) src); + if (src instanceof org.hl7.fhir.r4.model.Reference) + return convertReference((org.hl7.fhir.r4.model.Reference) src); + if (src instanceof org.hl7.fhir.r4.model.SampledData) + return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); + if (src instanceof org.hl7.fhir.r4.model.Signature) + return convertSignature((org.hl7.fhir.r4.model.Signature) src); + if (src instanceof org.hl7.fhir.r4.model.Address) + return convertAddress((org.hl7.fhir.r4.model.Address) src); + if (src instanceof org.hl7.fhir.r4.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.r4.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r4.model.Contributor) + return convertContributor((org.hl7.fhir.r4.model.Contributor) src); + if (src instanceof org.hl7.fhir.r4.model.Dosage) + return convertDosage((org.hl7.fhir.r4.model.Dosage) src); + if (src instanceof org.hl7.fhir.r4.model.HumanName) + return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); + if (src instanceof org.hl7.fhir.r4.model.Meta) + return convertMeta((org.hl7.fhir.r4.model.Meta) src); + if (src instanceof org.hl7.fhir.r4.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.r4.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.r4.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.r4.model.Timing) + return convertTiming((org.hl7.fhir.r4.model.Timing) src); + if (src instanceof org.hl7.fhir.r4.model.UsageContext) + return convertUsageContext((org.hl7.fhir.r4.model.UsageContext) src); + if (src instanceof org.hl7.fhir.r4.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.r4.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.r4.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.r4.model.TriggerDefinition) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t2)); + for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t3)); + } + + static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r4.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.r4.model.Extension t2 : src.getExtension()) if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t2)); + for (org.hl7.fhir.r4.model.Extension t3 : src.getModifierExtension()) if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t3)); + } + + static public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + org.hl7.fhir.r4.model.CanonicalType dst = new org.hl7.fhir.r4.model.CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r4.model.CanonicalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + static public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.r4.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EXISTS; + default: + return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.r4.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + static public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setUse(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasUse()) + tgt.setRole(convertCodeableConcept(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; + } + } + + static public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + } + } + + static final public String URN_IETF_RFC_3986 = "urn:ietf:rfc:3986"; + + public static String convertCoding2Uri(org.hl7.fhir.dstu3.model.Coding code) { + return code.getSystem() + "/" + code.getCode(); + } + + public static org.hl7.fhir.dstu3.model.Coding convertUri2Coding(String uri) { + int i = uri.lastIndexOf("/"); + return new org.hl7.fhir.dstu3.model.Coding().setSystem(uri.substring(0, i)).setCode(uri.substring(i + 1)); + } + + static public org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + static public org.hl7.fhir.r4.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.PASS; + case SKIP: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.SKIP; + case FAIL: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.FAIL; + case WARNING: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.WARNING; + case ERROR: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.ERROR; + default: + return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r4.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.PASS; + case SKIP: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.SKIP; + case FAIL: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.FAIL; + case WARNING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.WARNING; + case ERROR: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.ERROR; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public String convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return "application/fhir+xml"; + case JSON: + return "application/fhir+json"; + case TTL: + return "text/turtle"; + case NONE: + return null; + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + if (src.contains("json")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + if (src.contains("tu")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.TTL; + return org.hl7.fhir.dstu3.model.TestScript.ContentType.NONE; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + static public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EVAL; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EVAL; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DELETE: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PUT; + default: + return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DELETE: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PUT; + default: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.NULL; + } + } + + static public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EXISTS; + default: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EXISTS; + default: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return Parameters30_40.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.ActivityDefinition) + return ActivityDefinition30_40.convertActivityDefinition((org.hl7.fhir.dstu3.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.AllergyIntolerance) + return AllergyIntolerance30_40.convertAllergyIntolerance((org.hl7.fhir.dstu3.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Appointment) + return Appointment30_40.convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) + return AppointmentResponse30_40.convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) + return AuditEvent30_40.convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu3.model.Basic) + return Basic30_40.convertBasic((org.hl7.fhir.dstu3.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu3.model.Binary) + return Binary30_40.convertBinary((org.hl7.fhir.dstu3.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu3.model.BodySite) + return BodySite30_40.convertBodySite((org.hl7.fhir.dstu3.model.BodySite) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return Bundle30_40.convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return CapabilityStatement30_40.convertCapabilityStatement((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) + return CarePlan30_40.convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu3.model.CareTeam) + return CareTeam30_40.convertCareTeam((org.hl7.fhir.dstu3.model.CareTeam) src); + if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) + return ClinicalImpression30_40.convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) + return CodeSystem30_40.convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Communication) + return Communication30_40.convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) + return CompartmentDefinition30_40.convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Composition) + return Composition30_40.convertComposition((org.hl7.fhir.dstu3.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return ConceptMap30_40.convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Condition) + return Condition30_40.convertCondition((org.hl7.fhir.dstu3.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Consent) + return Consent30_40.convertConsent((org.hl7.fhir.dstu3.model.Consent) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return DataElement30_40.convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) + return DetectedIssue30_40.convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) + return DeviceUseStatement30_40.convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) + return DiagnosticReport30_40.convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) + return DocumentReference30_40.convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu3.model.Encounter) + return Encounter30_40.convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Endpoint) + return Endpoint30_40.convertEndpoint((org.hl7.fhir.dstu3.model.Endpoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) + return EpisodeOfCare30_40.convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu3.model.ExpansionProfile) + return ExpansionProfile30_40.convertExpansionProfile((org.hl7.fhir.dstu3.model.ExpansionProfile) src); + if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) + return FamilyMemberHistory30_40.convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu3.model.Flag) + return Flag30_40.convertFlag((org.hl7.fhir.dstu3.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu3.model.Goal) + return Goal30_40.convertGoal((org.hl7.fhir.dstu3.model.Goal) src); + if (src instanceof org.hl7.fhir.dstu3.model.GraphDefinition) + return GraphDefinition30_40.convertGraphDefinition((org.hl7.fhir.dstu3.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Group) + return Group30_40.convertGroup((org.hl7.fhir.dstu3.model.Group) src); + if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) + return HealthcareService30_40.convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) + return ImagingStudy30_40.convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.dstu3.model.Immunization) + return Immunization30_40.convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return ImplementationGuide30_40.convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.Library) + return Library30_40.convertLibrary((org.hl7.fhir.dstu3.model.Library) src); + if (src instanceof org.hl7.fhir.dstu3.model.Linkage) + return Linkage30_40.convertLinkage((org.hl7.fhir.dstu3.model.Linkage) src); + if (src instanceof org.hl7.fhir.dstu3.model.ListResource) + return List30_40.convertList((org.hl7.fhir.dstu3.model.ListResource) src); + if (src instanceof org.hl7.fhir.dstu3.model.Location) + return Location30_40.convertLocation((org.hl7.fhir.dstu3.model.Location) src); + if (src instanceof org.hl7.fhir.dstu3.model.Media) + return Media30_40.convertMedia((org.hl7.fhir.dstu3.model.Media) src); + if (src instanceof org.hl7.fhir.dstu3.model.Medication) + return Medication30_40.convertMedication((org.hl7.fhir.dstu3.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationAdministration) + return MedicationAdministration30_40.convertMedicationAdministration((org.hl7.fhir.dstu3.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) + return MedicationDispense30_40.convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationRequest) + return MedicationRequest30_40.convertMedicationRequest((org.hl7.fhir.dstu3.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) + return MedicationStatement30_40.convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageDefinition) + return MessageDefinition30_40.convertMessageDefinition((org.hl7.fhir.dstu3.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) + return MessageHeader30_40.convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return NamingSystem30_40.convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Observation) + return Observation30_40.convertObservation((org.hl7.fhir.dstu3.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return OperationDefinition30_40.convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return OperationOutcome30_40.convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Organization) + return Organization30_40.convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu3.model.Patient) + return Patient30_40.convertPatient((org.hl7.fhir.dstu3.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu3.model.PaymentNotice) + return PaymentNotice30_40.convertPaymentNotice((org.hl7.fhir.dstu3.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.dstu3.model.Person) + return Person30_40.convertPerson((org.hl7.fhir.dstu3.model.Person) src); + if (src instanceof org.hl7.fhir.dstu3.model.PlanDefinition) + return PlanDefinition30_40.convertPlanDefinition((org.hl7.fhir.dstu3.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) + return Practitioner30_40.convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu3.model.PractitionerRole) + return PractitionerRole30_40.convertPractitionerRole((org.hl7.fhir.dstu3.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.dstu3.model.Procedure) + return Procedure30_40.convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); + if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) + return ProcedureRequest30_40.convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.Provenance) + return Provenance30_40.convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return Questionnaire30_40.convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return QuestionnaireResponse30_40.convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) + return RelatedPerson30_40.convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) + return RiskAssessment30_40.convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu3.model.Schedule) + return Schedule30_40.convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return SearchParameter30_40.convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Sequence) + return Sequence30_40.convertSequence((org.hl7.fhir.dstu3.model.Sequence) src); + if (src instanceof org.hl7.fhir.dstu3.model.Slot) + return Slot30_40.convertSlot((org.hl7.fhir.dstu3.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu3.model.Specimen) + return Specimen30_40.convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return StructureDefinition30_40.convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureMap) + return StructureMap30_40.convertStructureMap((org.hl7.fhir.dstu3.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Subscription) + return Subscription30_40.convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu3.model.Substance) + return Substance30_40.convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) + return SupplyDelivery30_40.convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestReport) + return TestReport30_40.convertTestReport((org.hl7.fhir.dstu3.model.TestReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return TestScript30_40.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return ValueSet30_40.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); + if (!nullOk) + throw new FHIRException("Unknown resource " + src.fhirType()); else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } + return null; } - return tgt; - } - private static org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; - } -} - - public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasMap()) - tgt.setMap(src.getMap()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasMap()) - tgt.setMap(src.getMap()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.setFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.setFamily(src.getFamily()); - for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; - } -} - - public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); - for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ParameterDefinition tgt = new org.hl7.fhir.r4.model.ParameterDefinition(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) { - tgt.setProfile(convertReference(src.getProfile()).getReference()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.IN; - case OUT: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.OUT; - default: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL; - } -} - - public static org.hl7.fhir.r4.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.RelatedArtifact tgt = new org.hl7.fhir.r4.model.RelatedArtifact(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRelatedArtifactType(src.getType())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasCitation()) - tgt.setCitation(src.getCitation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDocument()) - tgt.setDocument(convertAttachment(src.getDocument())); - if (src.hasResource()) - tgt.setResourceElement(convertReferenceToCanonical(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RelatedArtifact tgt = new org.hl7.fhir.dstu3.model.RelatedArtifact(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRelatedArtifactType(src.getType())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasCitation()) - tgt.setCitation(src.getCitation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDocument()) - tgt.setDocument(convertAttachment(src.getDocument())); - if (src.hasResource()) - tgt.setResource(convertCanonicalToReference(src.getResourceElement())); - return tgt; - } - - private static org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENTATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; - case JUSTIFICATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; - case CITATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.CITATION; - case PREDECESSOR: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; - case SUCCESSOR: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; - case DERIVEDFROM: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; - case DEPENDSON: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; - case COMPOSEDOF: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; - default: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENTATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; - case JUSTIFICATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; - case CITATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.CITATION; - case PREDECESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; - case SUCCESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; - case DERIVEDFROM: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; - case DEPENDSON: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; - case COMPOSEDOF: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; - default: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - if (src.hasRepeat()) - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - if (src.hasRepeat()) - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - if (src.hasDurationUnit()) - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - if (src.hasPeriodUnit()) - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDayOfWeek()) - copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); - for (org.hl7.fhir.dstu3.model.TimeType t : src.getTimeOfDay()) - tgt.addTimeOfDay(t.getValue()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getWhen()) - copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - if (src.hasDurationUnit()) - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - if (src.hasPeriodUnit()) - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (org.hl7.fhir.r4.model.Enumeration t : src.getDayOfWeek()) - copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); - for (org.hl7.fhir.r4.model.TimeType t : src.getTimeOfDay()) - tgt.addTimeOfDay(t.getValue()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getWhen()) - copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; - } -} - - private static org.hl7.fhir.r4.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.dstu3.model.Timing.DayOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r4.model.Timing.DayOfWeek.MON; - case TUE: return org.hl7.fhir.r4.model.Timing.DayOfWeek.TUE; - case WED: return org.hl7.fhir.r4.model.Timing.DayOfWeek.WED; - case THU: return org.hl7.fhir.r4.model.Timing.DayOfWeek.THU; - case FRI: return org.hl7.fhir.r4.model.Timing.DayOfWeek.FRI; - case SAT: return org.hl7.fhir.r4.model.Timing.DayOfWeek.SAT; - case SUN: return org.hl7.fhir.r4.model.Timing.DayOfWeek.SUN; - default: return org.hl7.fhir.r4.model.Timing.DayOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r4.model.Timing.DayOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.NULL; - } -} - - private static org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MORN: return org.hl7.fhir.r4.model.Timing.EventTiming.MORN; - case AFT: return org.hl7.fhir.r4.model.Timing.EventTiming.AFT; - case EVE: return org.hl7.fhir.r4.model.Timing.EventTiming.EVE; - case NIGHT: return org.hl7.fhir.r4.model.Timing.EventTiming.NIGHT; - case PHS: return org.hl7.fhir.r4.model.Timing.EventTiming.PHS; - case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MORN: return org.hl7.fhir.dstu3.model.Timing.EventTiming.MORN; - case AFT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AFT; - case EVE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.EVE; - case NIGHT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NIGHT; - case PHS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PHS; - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; - } -} - - public static org.hl7.fhir.r4.model.UsageContext convertUsageContext(org.hl7.fhir.dstu3.model.UsageContext src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.UsageContext tgt = new org.hl7.fhir.r4.model.UsageContext(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCoding(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UsageContext convertUsageContext(org.hl7.fhir.r4.model.UsageContext src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.UsageContext tgt = new org.hl7.fhir.dstu3.model.UsageContext(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCoding(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r4.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.dstu3.model.TriggerDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TriggerDefinition tgt = new org.hl7.fhir.r4.model.TriggerDefinition(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTriggerType(src.getType())); - if (src.hasEventName()) - tgt.setName(src.getEventName()); - if (src.hasEventTiming()) - tgt.setTiming(convertType(src.getEventTiming())); - if (src.hasEventData()) - tgt.addData(convertDataRequirement(src.getEventData())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r4.model.TriggerDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TriggerDefinition tgt = new org.hl7.fhir.dstu3.model.TriggerDefinition(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTriggerType(src.getType())); - if (src.hasName()) - tgt.setEventName(src.getName()); - if (src.hasTiming()) - tgt.setEventTiming(convertType(src.getTiming())); - if (src.hasData()) - tgt.setEventData(convertDataRequirement(src.getDataFirstRep())); - return tgt; - } - - public static org.hl7.fhir.r4.model.DataRequirement convertDataRequirement(org.hl7.fhir.dstu3.model.DataRequirement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getMustSupport()) - tgt.addMustSupport(t.getValue()); - for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) - tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) - tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement convertDataRequirement(org.hl7.fhir.r4.model.DataRequirement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement tgt = new org.hl7.fhir.dstu3.model.DataRequirement(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getMustSupport()) - tgt.addMustSupport(t.getValue()); - for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) - tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); - for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) - tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValueSet()) { - Type t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r4.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - for (org.hl7.fhir.dstu3.model.CodeType t : src.getValueCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getValueCoding()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getValueCodeableConcept()) - tgt.addCode(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) { - tgt.addValueCoding(convertCoding(t)); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - - private static org.hl7.fhir.r4.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NAMEDEVENT: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NAMEDEVENT; - case PERIODIC: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.PERIODIC; - case DATAADDED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAADDED; - case DATAMODIFIED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAMODIFIED; - case DATAREMOVED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAREMOVED; - case DATAACCESSED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSED; - case DATAACCESSENDED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSENDED; - default: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r4.model.TriggerDefinition.TriggerType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NAMEDEVENT: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NAMEDEVENT; - case PERIODIC: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.PERIODIC; - case DATAADDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAADDED; - case DATAMODIFIED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAMODIFIED; - case DATAREMOVED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAREMOVED; - case DATAACCESSED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSED; - case DATAACCESSENDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSENDED; - default: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NULL; - } -} - - - public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactDetail) - return convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.Contributor) - return convertContributor((org.hl7.fhir.dstu3.model.Contributor) src); - if (src instanceof org.hl7.fhir.dstu3.model.Dosage) - return convertDosage((org.hl7.fhir.dstu3.model.Dosage) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.ParameterDefinition) - return convertParameterDefinition((org.hl7.fhir.dstu3.model.ParameterDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedArtifact) - return convertRelatedArtifact((org.hl7.fhir.dstu3.model.RelatedArtifact) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu3.model.UsageContext) - return convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataRequirement) - return convertDataRequirement((org.hl7.fhir.dstu3.model.DataRequirement) src); - if (src instanceof org.hl7.fhir.dstu3.model.TriggerDefinition) - return convertTriggerDefinition((org.hl7.fhir.dstu3.model.TriggerDefinition) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r4.model.BooleanType) - return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r4.model.CodeType) - return convertCode((org.hl7.fhir.r4.model.CodeType) src); - if (src instanceof org.hl7.fhir.r4.model.DateType) - return convertDate((org.hl7.fhir.r4.model.DateType) src); - if (src instanceof org.hl7.fhir.r4.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r4.model.DecimalType) - return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r4.model.IdType) - return convertId((org.hl7.fhir.r4.model.IdType) src); - if (src instanceof org.hl7.fhir.r4.model.InstantType) - return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r4.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r4.model.OidType) - return convertOid((org.hl7.fhir.r4.model.OidType) src); - if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r4.model.StringType) - return convertString((org.hl7.fhir.r4.model.StringType) src); - if (src instanceof org.hl7.fhir.r4.model.TimeType) - return convertTime((org.hl7.fhir.r4.model.TimeType) src); - if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r4.model.UriType) - return convertUri((org.hl7.fhir.r4.model.UriType) src); - if (src instanceof org.hl7.fhir.r4.model.UuidType) - return convertUuid((org.hl7.fhir.r4.model.UuidType) src); - if (src instanceof org.hl7.fhir.r4.model.Extension) - return convertExtension((org.hl7.fhir.r4.model.Extension) src); - if (src instanceof org.hl7.fhir.r4.model.Narrative) - return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); - if (src instanceof org.hl7.fhir.r4.model.Age) - return convertAge((org.hl7.fhir.r4.model.Age) src); - if (src instanceof org.hl7.fhir.r4.model.Annotation) - return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); - if (src instanceof org.hl7.fhir.r4.model.Attachment) - return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); - if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r4.model.Coding) - return convertCoding((org.hl7.fhir.r4.model.Coding) src); - if (src instanceof org.hl7.fhir.r4.model.Count) - return convertCount((org.hl7.fhir.r4.model.Count) src); - if (src instanceof org.hl7.fhir.r4.model.Distance) - return convertDistance((org.hl7.fhir.r4.model.Distance) src); - if (src instanceof org.hl7.fhir.r4.model.Duration) - return convertDuration((org.hl7.fhir.r4.model.Duration) src); - if (src instanceof org.hl7.fhir.r4.model.Identifier) - return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); - if (src instanceof org.hl7.fhir.r4.model.Money) - return convertMoney((org.hl7.fhir.r4.model.Money) src); - if (src instanceof org.hl7.fhir.r4.model.Period) - return convertPeriod((org.hl7.fhir.r4.model.Period) src); - if (src instanceof org.hl7.fhir.r4.model.Quantity) - return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); - if (src instanceof org.hl7.fhir.r4.model.Range) - return convertRange((org.hl7.fhir.r4.model.Range) src); - if (src instanceof org.hl7.fhir.r4.model.Ratio) - return convertRatio((org.hl7.fhir.r4.model.Ratio) src); - if (src instanceof org.hl7.fhir.r4.model.Reference) - return convertReference((org.hl7.fhir.r4.model.Reference) src); - if (src instanceof org.hl7.fhir.r4.model.SampledData) - return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); - if (src instanceof org.hl7.fhir.r4.model.Signature) - return convertSignature((org.hl7.fhir.r4.model.Signature) src); - if (src instanceof org.hl7.fhir.r4.model.Address) - return convertAddress((org.hl7.fhir.r4.model.Address) src); - if (src instanceof org.hl7.fhir.r4.model.ContactDetail) - return convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) src); - if (src instanceof org.hl7.fhir.r4.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r4.model.Contributor) - return convertContributor((org.hl7.fhir.r4.model.Contributor) src); - if (src instanceof org.hl7.fhir.r4.model.Dosage) - return convertDosage((org.hl7.fhir.r4.model.Dosage) src); - if (src instanceof org.hl7.fhir.r4.model.HumanName) - return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); - if (src instanceof org.hl7.fhir.r4.model.Meta) - return convertMeta((org.hl7.fhir.r4.model.Meta) src); - if (src instanceof org.hl7.fhir.r4.model.ParameterDefinition) - return convertParameterDefinition((org.hl7.fhir.r4.model.ParameterDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.RelatedArtifact) - return convertRelatedArtifact((org.hl7.fhir.r4.model.RelatedArtifact) src); - if (src instanceof org.hl7.fhir.r4.model.Timing) - return convertTiming((org.hl7.fhir.r4.model.Timing) src); - if (src instanceof org.hl7.fhir.r4.model.UsageContext) - return convertUsageContext((org.hl7.fhir.r4.model.UsageContext) src); - if (src instanceof org.hl7.fhir.r4.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.DataRequirement) - return convertDataRequirement((org.hl7.fhir.r4.model.DataRequirement) src); - if (src instanceof org.hl7.fhir.r4.model.TriggerDefinition) - return convertTriggerDefinition((org.hl7.fhir.r4.model.TriggerDefinition) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) - tgt.addContained(convertResource(t1, false)); - for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) - if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t2)); - for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) - if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t3)); - } - private static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r4.model.Resource t1 : src.getContained()) - tgt.addContained(convertResource(t1, false)); - for (org.hl7.fhir.r4.model.Extension t2 : src.getExtension()) - if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t2)); - for (org.hl7.fhir.r4.model.Extension t3 : src.getModifierExtension()) - if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t3)); - } - public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - - public static org.hl7.fhir.r4.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ActivityDefinition tgt = new org.hl7.fhir.r4.model.ActivityDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) - tgt.getLibrary().add(convertReferenceToCanonical(t)); - if (src.hasKind()) - tgt.setKind(convertActivityDefinitionKind(src.getKind())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); - if (src.hasProduct()) - tgt.setProduct(convertType(src.getProduct())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasTransform()) - tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); - for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r4.model.ActivityDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) - tgt.addLibrary(convertCanonicalToReference(t)); - if (src.hasKind()) - tgt.setKind(convertActivityDefinitionKind(src.getKind())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); - if (src.hasProduct()) - tgt.setProduct(convertType(src.getProduct())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasTransform()) - tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); - for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPOINTMENT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; - case APPOINTMENTRESPONSE: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; - case CAREPLAN: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; - case CLAIM: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; - case COMMUNICATIONREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; - case CONTRACT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; - case DEVICEREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; - case ENROLLMENTREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; - case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; - case MEDICATIONREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; - case NUTRITIONORDER: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; - case PROCEDUREREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; - case REFERRALREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; - case SUPPLYREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; - case TASK: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.TASK; - case VISIONPRESCRIPTION: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; - default: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPOINTMENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; - case APPOINTMENTRESPONSE: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; - case CAREPLAN: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; - case CLAIM: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; - case COMMUNICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; - case CONTRACT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; - case DEVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; - case ENROLLMENTREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; - case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; - case MEDICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; - case NUTRITIONORDER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; - case SERVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST; - case SUPPLYREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; - case TASK: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK; - case VISIONPRESCRIPTION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; - default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL; - } -} - - public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActivityParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActivityParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL; - } -} - - public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); - if (src.hasType()) - tgt.setType(convertAllergyIntoleranceType(src.getType())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getCategory()) - copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); - if (src.hasCriticality()) - tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAssertedDate()) - tgt.setRecordedDateElement(convertDateTime(src.getAssertedDateElement())); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasLastOccurrence()) - tgt.setLastOccurrenceElement(convertDateTime(src.getLastOccurrenceElement())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) - tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r4.model.AllergyIntolerance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); - if (src.hasType()) - tgt.setType(convertAllergyIntoleranceType(src.getType())); - for (org.hl7.fhir.r4.model.Enumeration t : src.getCategory()) - copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); - if (src.hasCriticality()) - tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasRecordedDate()) - tgt.setAssertedDate(src.getRecordedDate()); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasLastOccurrence()) - tgt.setLastOccurrenceElement(convertDateTime(src.getLastOccurrenceElement())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) - tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); - case INACTIVE: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); - case RESOLVED: new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; - } - - private static org.hl7.fhir.r4.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNCONFIRMED: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); - case CONFIRMED: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); - case REFUTED: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); - case ENTEREDINERROR: return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; - } - - private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ALLERGY: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; - case INTOLERANCE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; - default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ALLERGY: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; - case INTOLERANCE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL; - } -} - - private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FOOD: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; - case MEDICATION: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; - case ENVIRONMENT: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; - case BIOLOGIC: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; - default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FOOD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; - case MEDICATION: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; - case ENVIRONMENT: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; - case BIOLOGIC: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; - } -} - - private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LOW: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; - case HIGH: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; - case UNABLETOASSESS: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; - default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LOW: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; - case HIGH: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; - case UNABLETOASSESS: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; - } -} - - public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); - copyElement(src, tgt); - if (src.hasSubstance()) - tgt.setSubstance(convertCodeableConcept(src.getSubstance())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) - tgt.addManifestation(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOnset()) - tgt.setOnsetElement(convertDateTime(src.getOnsetElement())); - if (src.hasSeverity()) - tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); - if (src.hasExposureRoute()) - tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); - copyElement(src, tgt); - if (src.hasSubstance()) - tgt.setSubstance(convertCodeableConcept(src.getSubstance())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation()) - tgt.addManifestation(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOnset()) - tgt.setOnsetElement(convertDateTime(src.getOnsetElement())); - if (src.hasSeverity()) - tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); - if (src.hasExposureRoute()) - tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MILD: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; - case MODERATE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; - case SEVERE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; - default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MILD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; - case MODERATE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; - case SEVERE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; - } -} - - public static org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) - tgt.addReasonReference(convertReference(t)); - if (src.hasPriority()) - tgt.setPriority(src.getPriority()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasMinutesDuration()) - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - if (src.hasCreated()) - tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) - tgt.addRequestedPeriod(convertPeriod(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addIndication(convertReference(t)); - if (src.hasPriority()) - tgt.setPriority(src.getPriority()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasMinutesDuration()) - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - if (src.hasCreated()) - tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - for (org.hl7.fhir.r4.model.Period t : src.getRequestedPeriod()) - tgt.addRequestedPeriod(convertPeriod(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r4.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); - if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); - if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; - } -} - - private static org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointment())); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointment())); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - private static org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) - tgt.addSubtype(convertCoding(t)); - if (src.hasAction()) - tgt.setAction(convertAuditEventAction(src.getAction())); - if (src.hasRecorded()) - tgt.setRecordedElement(convertInstant(src.getRecordedElement())); - if (src.hasOutcome()) - tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); - if (src.hasOutcomeDesc()) - tgt.setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) - tgt.addPurposeOfEvent(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - if (src.hasSource()) - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) - tgt.addSubtype(convertCoding(t)); - if (src.hasAction()) - tgt.setAction(convertAuditEventAction(src.getAction())); - if (src.hasRecorded()) - tgt.setRecordedElement(convertInstant(src.getRecordedElement())); - if (src.hasOutcome()) - tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); - if (src.hasOutcomeDesc()) - tgt.setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) - tgt.addPurposeOfEvent(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - if (src.hasSource()) - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; - } -} - - private static org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; - } -} - - public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasReference()) - tgt.setWho(convertReference(src.getReference())); - if (src.hasUserId()) - tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); - if (src.hasAltId()) - tgt.setAltId(src.getAltId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRequestor()) - tgt.setRequestor(src.getRequestor()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasMedia()) - tgt.setMedia(convertCoding(src.getMedia())); - if (src.hasNetwork()) - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) - tgt.addPurposeOfUse(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - if (src.getWho().hasIdentifier()) - tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); - if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) - tgt.setReference(convertReference(src.getWho())); - } - if (src.hasAltId()) - tgt.setAltId(src.getAltId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRequestor()) - tgt.setRequestor(src.getRequestor()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasMedia()) - tgt.setMedia(convertCoding(src.getMedia())); - if (src.hasNetwork()) - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) - tgt.addPurposeOfUse(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - if (src.hasType()) - tgt.setType(convertAuditEventAgentNetworkType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - if (src.hasType()) - tgt.setType(convertAuditEventAgentNetworkType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } -} - - public static org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - if (src.hasSite()) - tgt.setSite(src.getSite()); - if (src.hasIdentifier()) - tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - if (src.hasSite()) - tgt.setSite(src.getSite()); - if (src.hasObserver()) - tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasReference()) - tgt.setWhat(convertReference(src.getReference())); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCoding(src.getRole())); - if (src.hasLifecycle()) - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasQuery()) - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasWhat()) { - if (src.getWhat().hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); - if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) - tgt.setReference(convertReference(src.getWhat())); - } - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCoding(src.getRole())); - if (src.hasLifecycle()) - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasQuery()) - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasValue()) - tgt.setValue(new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasValueStringType()) - tgt.setValue(src.getValueStringType().getValue().getBytes()); - else if (src.hasValueBase64BinaryType()) - tgt.setValue(src.getValueBase64BinaryType().getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setCreatedElement(convertDate(src.getCreatedElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setCreatedElement(convertDate(src.getCreatedElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); - copyResource(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasSecurityContext()) - tgt.setSecurityContext(convertReference(src.getSecurityContext())); - if (src.hasContent()) - tgt.setData(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasSecurityContext()) - tgt.setSecurityContext(convertReference(src.getSecurityContext())); - if (src.hasData()) - tgt.setContent(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r4.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.BodyStructure tgt = new org.hl7.fhir.r4.model.BodyStructure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getQualifier()) -// tgt.addQualifier(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) - tgt.addImage(convertAttachment(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r4.model.BodyStructure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getQualifier()) -// tgt.addQualifier(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) - tgt.addImage(convertAttachment(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); - copyResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - if (src.hasRelation()) - tgt.setRelation(src.getRelation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - if (src.hasRelation()) - tgt.setRelation(src.getRelation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; - } -} - - public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModifiedElement(convertInstant(src.getLastModifiedElement())); - if (src.hasOutcome()) - tgt.setOutcome(convertResource(src.getOutcome(), false)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModifiedElement(convertInstant(src.getLastModifiedElement())); - if (src.hasOutcome()) - tgt.setOutcome(convertResource(src.getOutcome(), false)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasKind()) - tgt.setKind(convertCapabilityStatementKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) - tgt.addInstantiates(t.getValue()); - if (src.hasSoftware()) - tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); - 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())); - 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.Reference t : src.getProfile()) - tgt.addExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", convertReference(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertCapabilityStatementRestComponent(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()) - tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); - return tgt; - } - - 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(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasKind()) - tgt.setKind(convertCapabilityStatementKind(src.getKind())); - for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) - tgt.addInstantiates(t.getValue()); - if (src.hasSoftware()) - tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - 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())); - 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()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(convertCanonicalToReference(t)); - for (org.hl7.fhir.r4.model.Extension ext : src.getExtension()) { - if ("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile".equals(ext.getUrl())) { - tgt.addProfile(convertReference((org.hl7.fhir.r4.model.Reference) ext.getValue())); - } - } - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertCapabilityStatementRestComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } -} - -// private static org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; -// } -//} - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDateElement(convertDateTime(src.getReleaseDateElement())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDateElement(convertDateTime(src.getReleaseDateElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertRestfulCapabilityMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSecurity()) - tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertRestfulCapabilityMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSecurity()) - tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalRead()) - tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getReferencePolicy()) - copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - org.hl7.fhir.r4.model.CanonicalType dst = new org.hl7.fhir.r4.model.CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private static org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r4.model.CanonicalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalRead()) - tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r4.model.Enumeration t : src.getReferencePolicy()) - copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } -} - - private static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; - case MODIFIEDSINCE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; - case NOTMATCH: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; - case FULLSUPPORT: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; - case MODIFIEDSINCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; - case NOTMATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; - case FULLSUPPORT: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LITERAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; - case LOGICAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; - case RESOLVES: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; - case ENFORCED: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; - case LOCAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LITERAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; - case LOGICAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; - case RESOLVES: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; - case ENFORCED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; - case LOCAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; - } -} - - public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case PATCH: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.PATCH; - case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case PATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.PATCH; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } -} - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } -} - - public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case BATCH: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.BATCH; - case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case BATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.BATCH; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } -} - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) - tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); - org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) - tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); - for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - if (src.hasProtocol()) - tgt.setProtocol(convertCoding(src.getProtocol())); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - if (src.hasProtocol()) - tgt.setProtocol(convertCoding(src.getProtocol())); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertEventCapabilityMode(src.getMode())); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertEventCapabilityMode(src.getMode())); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } -} - - - public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - private static org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertCarePlanIntent(src.getIntent())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - List authors = src.getAuthor(); - if (authors.size() > 0) { - tgt.setAuthor(convertReference(authors.get(0))); - if (authors.size() > 1) { - // TODO print a warning that only one author could be converted - } - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) { - tgt.addCareTeam(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) { - tgt.addAddresses(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { - tgt.addActivity(convertCarePlanActivityComponent(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertCarePlanIntent(src.getIntent())); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - if (src.hasAuthor()) { - tgt.addAuthor(convertReference(src.getAuthor())); - } - for (org.hl7.fhir.r4.model.Reference t : src.getCareTeam()) { - tgt.addCareTeam(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) { - tgt.addAddresses(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { - tgt.addActivity(convertCarePlanActivityComponent(t)); - } - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - - return tgt; - } - - public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); - - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { - tgt.addOutcomeCodeableConcept(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) { - tgt.addOutcomeReference(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) { - tgt.addProgress(convertAnnotation(t)); - } - if (src.hasReference()) { - tgt.setReference(convertReference(src.getReference())); - } - if (src.hasDetail()) { - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); - - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { - tgt.addOutcomeCodeableConcept(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) { - tgt.addOutcomeReference(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) { - tgt.addProgress(convertAnnotation(t)); - } - if (src.hasReference()) { - tgt.setReference(convertReference(src.getReference())); - } - if (src.hasDetail()) { - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - } - - return tgt; - } - - private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category"; - - public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - - if (src.hasCategory()) { - org.hl7.fhir.r4.model.Extension t = new org.hl7.fhir.r4.model.Extension(); - t.setUrl(CarePlanActivityDetailComponentExtension); - t.setValue(convertType(src.getCategory())); - tgt.addExtension(t); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); - } - if (src.hasStatusReason()) { - org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding(); - code.setCode(src.getStatusReason()); - org.hl7.fhir.r4.model.CodeableConcept t = new org.hl7.fhir.r4.model.CodeableConcept(code); - tgt.setStatusReason(t); - } - if (src.hasProhibited()) { - tgt.setDoNotPerform(src.getProhibited()); - } - if (src.hasScheduled()) { - tgt.setScheduled(convertType(src.getScheduled())); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) { - tgt.addPerformer(convertReference(t)); - } - if (src.hasProduct()) { - tgt.setProduct(convertType(src.getProduct())); - } - if (src.hasDailyAmount()) { - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - } - if (src.hasQuantity()) { - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - - if (src.hasExtension()) { - org.hl7.fhir.r4.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension); - if (extension != null) { - org.hl7.fhir.r4.model.Type value = extension.getValue(); - if (value instanceof org.hl7.fhir.r4.model.CodeableConcept) { - tgt.setCategory(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) value)); + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r4.model.Parameters) { + if (((org.hl7.fhir.r4.model.Parameters) src).hasParameter("profile-url")) + return ExpansionProfile30_40.convertExpansionProfile((org.hl7.fhir.r4.model.Parameters) src); + else + return Parameters30_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src); } - } - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); - } - if (src.hasStatusReason()) { - List coding = src.getStatusReason().getCoding(); - if (coding.size() > 0) { - tgt.setStatusReason(coding.get(0).getCode()); - } - } - if (src.hasDoNotPerform()) { - tgt.setProhibited(src.getDoNotPerform()); - } - if (src.hasScheduled()) { - tgt.setScheduled(convertType(src.getScheduled())); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) { - tgt.addPerformer(convertReference(t)); - } - if (src.hasProduct()) { - tgt.setProduct(convertType(src.getProduct())); - } - if (src.hasDailyAmount()) { - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - } - if (src.hasQuantity()) { - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); + if (src instanceof org.hl7.fhir.r4.model.ActivityDefinition) + return ActivityDefinition30_40.convertActivityDefinition((org.hl7.fhir.r4.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.AllergyIntolerance) + return AllergyIntolerance30_40.convertAllergyIntolerance((org.hl7.fhir.r4.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.r4.model.Appointment) + return Appointment30_40.convertAppointment((org.hl7.fhir.r4.model.Appointment) src); + if (src instanceof org.hl7.fhir.r4.model.AppointmentResponse) + return AppointmentResponse30_40.convertAppointmentResponse((org.hl7.fhir.r4.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r4.model.AuditEvent) + return AuditEvent30_40.convertAuditEvent((org.hl7.fhir.r4.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r4.model.Basic) + return Basic30_40.convertBasic((org.hl7.fhir.r4.model.Basic) src); + if (src instanceof org.hl7.fhir.r4.model.Binary) + return Binary30_40.convertBinary((org.hl7.fhir.r4.model.Binary) src); + if (src instanceof org.hl7.fhir.r4.model.BodyStructure) + return BodySite30_40.convertBodySite((org.hl7.fhir.r4.model.BodyStructure) src); + if (src instanceof org.hl7.fhir.r4.model.Bundle) + return Bundle30_40.convertBundle((org.hl7.fhir.r4.model.Bundle) src); + if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) + return CapabilityStatement30_40.convertCapabilityStatement((org.hl7.fhir.r4.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r4.model.CarePlan) + return CarePlan30_40.convertCarePlan((org.hl7.fhir.r4.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r4.model.CareTeam) + return CareTeam30_40.convertCareTeam((org.hl7.fhir.r4.model.CareTeam) src); + if (src instanceof org.hl7.fhir.r4.model.ClinicalImpression) + return ClinicalImpression30_40.convertClinicalImpression((org.hl7.fhir.r4.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r4.model.CodeSystem) + return CodeSystem30_40.convertCodeSystem((org.hl7.fhir.r4.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r4.model.Communication) + return Communication30_40.convertCommunication((org.hl7.fhir.r4.model.Communication) src); + if (src instanceof org.hl7.fhir.r4.model.CompartmentDefinition) + return CompartmentDefinition30_40.convertCompartmentDefinition((org.hl7.fhir.r4.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Composition) + return Composition30_40.convertComposition((org.hl7.fhir.r4.model.Composition) src); + if (src instanceof org.hl7.fhir.r4.model.ConceptMap) + return ConceptMap30_40.convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r4.model.Condition) + return Condition30_40.convertCondition((org.hl7.fhir.r4.model.Condition) src); + if (src instanceof org.hl7.fhir.r4.model.Consent) + return Consent30_40.convertConsent((org.hl7.fhir.r4.model.Consent) src); + if (src instanceof org.hl7.fhir.r4.model.DetectedIssue) + return DetectedIssue30_40.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement) + return DeviceUseStatement30_40.convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport) + return DiagnosticReport30_40.convertDiagnosticReport((org.hl7.fhir.r4.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r4.model.DocumentReference) + return DocumentReference30_40.convertDocumentReference((org.hl7.fhir.r4.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r4.model.Encounter) + return Encounter30_40.convertEncounter((org.hl7.fhir.r4.model.Encounter) src); + if (src instanceof org.hl7.fhir.r4.model.Endpoint) + return Endpoint30_40.convertEndpoint((org.hl7.fhir.r4.model.Endpoint) src); + if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare) + return EpisodeOfCare30_40.convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r4.model.FamilyMemberHistory) + return FamilyMemberHistory30_40.convertFamilyMemberHistory((org.hl7.fhir.r4.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r4.model.Flag) + return Flag30_40.convertFlag((org.hl7.fhir.r4.model.Flag) src); + if (src instanceof org.hl7.fhir.r4.model.Goal) + return Goal30_40.convertGoal((org.hl7.fhir.r4.model.Goal) src); + if (src instanceof org.hl7.fhir.r4.model.GraphDefinition) + return GraphDefinition30_40.convertGraphDefinition((org.hl7.fhir.r4.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Group) + return Group30_40.convertGroup((org.hl7.fhir.r4.model.Group) src); + if (src instanceof org.hl7.fhir.r4.model.HealthcareService) + return HealthcareService30_40.convertHealthcareService((org.hl7.fhir.r4.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r4.model.ImagingStudy) + return ImagingStudy30_40.convertImagingStudy((org.hl7.fhir.r4.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.r4.model.Immunization) + return Immunization30_40.convertImmunization((org.hl7.fhir.r4.model.Immunization) src); + if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) + return ImplementationGuide30_40.convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r4.model.Library) + return Library30_40.convertLibrary((org.hl7.fhir.r4.model.Library) src); + if (src instanceof org.hl7.fhir.r4.model.Linkage) + return Linkage30_40.convertLinkage((org.hl7.fhir.r4.model.Linkage) src); + if (src instanceof org.hl7.fhir.r4.model.ListResource) + return List30_40.convertList((org.hl7.fhir.r4.model.ListResource) src); + if (src instanceof org.hl7.fhir.r4.model.Location) + return Location30_40.convertLocation((org.hl7.fhir.r4.model.Location) src); + if (src instanceof org.hl7.fhir.r4.model.Media) + return Media30_40.convertMedia((org.hl7.fhir.r4.model.Media) src); + if (src instanceof org.hl7.fhir.r4.model.Medication) + return Medication30_40.convertMedication((org.hl7.fhir.r4.model.Medication) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationAdministration) + return MedicationAdministration30_40.convertMedicationAdministration((org.hl7.fhir.r4.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationDispense) + return MedicationDispense30_40.convertMedicationDispense((org.hl7.fhir.r4.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationRequest) + return MedicationRequest30_40.convertMedicationRequest((org.hl7.fhir.r4.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationStatement) + return MedicationStatement30_40.convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r4.model.MessageDefinition) + return MessageDefinition30_40.convertMessageDefinition((org.hl7.fhir.r4.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.MessageHeader) + return MessageHeader30_40.convertMessageHeader((org.hl7.fhir.r4.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r4.model.NamingSystem) + return NamingSystem30_40.convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r4.model.Observation) + return Observation30_40.convertObservation((org.hl7.fhir.r4.model.Observation) src); + if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) + return OperationDefinition30_40.convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) + return OperationOutcome30_40.convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r4.model.Organization) + return Organization30_40.convertOrganization((org.hl7.fhir.r4.model.Organization) src); + if (src instanceof org.hl7.fhir.r4.model.Patient) + return Patient30_40.convertPatient((org.hl7.fhir.r4.model.Patient) src); + if (src instanceof org.hl7.fhir.r4.model.PaymentNotice) + return PaymentNotice30_40.convertPaymentNotice((org.hl7.fhir.r4.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.r4.model.Person) + return Person30_40.convertPerson((org.hl7.fhir.r4.model.Person) src); + if (src instanceof org.hl7.fhir.r4.model.PlanDefinition) + return PlanDefinition30_40.convertPlanDefinition((org.hl7.fhir.r4.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Practitioner) + return Practitioner30_40.convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r4.model.PractitionerRole) + return PractitionerRole30_40.convertPractitionerRole((org.hl7.fhir.r4.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.r4.model.Procedure) + return Procedure30_40.convertProcedure((org.hl7.fhir.r4.model.Procedure) src); + if (src instanceof org.hl7.fhir.r4.model.ServiceRequest) + return ProcedureRequest30_40.convertProcedureRequest((org.hl7.fhir.r4.model.ServiceRequest) src); + if (src instanceof org.hl7.fhir.r4.model.Provenance) + return Provenance30_40.convertProvenance((org.hl7.fhir.r4.model.Provenance) src); + if (src instanceof org.hl7.fhir.r4.model.Questionnaire) + return Questionnaire30_40.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) + return QuestionnaireResponse30_40.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r4.model.RelatedPerson) + return RelatedPerson30_40.convertRelatedPerson((org.hl7.fhir.r4.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.r4.model.RiskAssessment) + return RiskAssessment30_40.convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r4.model.Schedule) + return Schedule30_40.convertSchedule((org.hl7.fhir.r4.model.Schedule) src); + if (src instanceof org.hl7.fhir.r4.model.SearchParameter) + return SearchParameter30_40.convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r4.model.MolecularSequence) + return Sequence30_40.convertSequence((org.hl7.fhir.r4.model.MolecularSequence) src); + if (src instanceof org.hl7.fhir.r4.model.Slot) + return Slot30_40.convertSlot((org.hl7.fhir.r4.model.Slot) src); + if (src instanceof org.hl7.fhir.r4.model.Specimen) + return Specimen30_40.convertSpecimen((org.hl7.fhir.r4.model.Specimen) src); + if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) + return StructureDefinition30_40.convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.StructureMap) + return StructureMap30_40.convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r4.model.Subscription) + return Subscription30_40.convertSubscription((org.hl7.fhir.r4.model.Subscription) src); + if (src instanceof org.hl7.fhir.r4.model.Substance) + return Substance30_40.convertSubstance((org.hl7.fhir.r4.model.Substance) src); + if (src instanceof org.hl7.fhir.r4.model.SupplyDelivery) + return SupplyDelivery30_40.convertSupplyDelivery((org.hl7.fhir.r4.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r4.model.TestReport) + return TestReport30_40.convertTestReport((org.hl7.fhir.r4.model.TestReport) src); + if (src instanceof org.hl7.fhir.r4.model.TestScript) + return TestScript30_40.convertTestScript((org.hl7.fhir.r4.model.TestScript) src); + if (src instanceof org.hl7.fhir.r4.model.ValueSet) + return ValueSet30_40.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); + if (!nullOk) + throw new FHIRException("Unknown resource " + src.fhirType()); + else + return null; } - return tgt; - } - - private static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) { - if (src == null) - return null; - switch (src) { - case CANCELLED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case INPROGRESS: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case NOTSTARTED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case ONHOLD: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case SCHEDULED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case UNKNOWN: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.UNKNOWN; - default: - return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus src) { - if (src == null) - return null; - switch (src) { - case CANCELLED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case INPROGRESS: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case NOTSTARTED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case ONHOLD: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case SCHEDULED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - private static org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; - case CANCELLED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED; - case COMPLETED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ENTEREDINERROR; - case SUSPENDED: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ONHOLD; - case UNKNOWN: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.UNKNOWN; - default: - return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; - case REVOKED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ENTEREDINERROR; - case ONHOLD: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.SUSPENDED; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; - } - } - - private static org.hl7.fhir.r4.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPTION: - return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.OPTION; - case ORDER: - return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.ORDER; - case PLAN: - return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PROPOSAL; - default: - return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPTION: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.OPTION; - case ORDER: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.ORDER; - case PLAN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PROPOSAL; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.NULL; - } - } - - public static org.hl7.fhir.r4.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CareTeam tgt = new org.hl7.fhir.r4.model.CareTeam(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertCareTeamStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertCareTeamParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) - tgt.addManagingOrganization(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r4.model.CareTeam src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertCareTeamStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertCareTeamParticipantComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getManagingOrganization()) - tgt.addManagingOrganization(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.PROPOSED; - case ACTIVE: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r4.model.CareTeam.CareTeamStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED; - case ACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.addRole(convertCodeableConcept(src.getRole())); - if (src.hasMember()) - tgt.setMember(convertReference(src.getMember())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRoleFirstRep())); - if (src.hasMember()) - tgt.setMember(convertReference(src.getMember())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - -// public static org.hl7.fhir.r4.model.Claim convertClaim(org.hl7.fhir.dstu3.model.Claim src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim tgt = new org.hl7.fhir.r4.model.Claim(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertClaimStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasUse()) -// tgt.setUse(convertUse(src.getUse())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasBillablePeriod()) -// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); -// if (src.hasCreated()) -// tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); -// if (src.hasEnterer()) -// tgt.setEnterer(convertReference(src.getEnterer())); -// if (src.hasInsurer()) -// tgt.setInsurer(convertReference(src.getInsurer())); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -//// if (src.hasOrganization()) -//// tgt.addOrganization(convertReference(src.getOrganization())); -// if (src.hasPriority()) -// tgt.setPriority(convertCodeableConcept(src.getPriority())); -// if (src.hasFundsReserve()) -// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); -// for (org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent t : src.getRelated()) -// tgt.addRelated(convertRelatedClaimComponent(t)); -// if (src.hasPrescription()) -// tgt.setPrescription(convertReference(src.getPrescription())); -// if (src.hasOriginalPrescription()) -// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); -// if (src.hasPayee()) -// tgt.setPayee(convertPayeeComponent(src.getPayee())); -// if (src.hasReferral()) -// tgt.setReferral(convertReference(src.getReferral())); -// if (src.hasFacility()) -// tgt.setFacility(convertReference(src.getFacility())); -// for (org.hl7.fhir.dstu3.model.Claim.CareTeamComponent t : src.getCareTeam()) -// tgt.addCareTeam(convertCareTeamComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent t : src.getInformation()) -// tgt.addInformation(convertSpecialConditionComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent t : src.getDiagnosis()) -// tgt.addDiagnosis(convertDiagnosisComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.ProcedureComponent t : src.getProcedure()) -// tgt.addProcedure(convertProcedureComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.InsuranceComponent t : src.getInsurance()) -// tgt.addInsurance(convertInsuranceComponent(t)); -// if (src.hasAccident()) -// tgt.setAccident(convertAccidentComponent(src.getAccident())); -//// if (src.hasEmploymentImpacted()) -//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); -//// if (src.hasHospitalization()) -//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); -// for (org.hl7.fhir.dstu3.model.Claim.ItemComponent t : src.getItem()) -// tgt.addItem(convertItemComponent(t)); -// if (src.hasTotal()) -// tgt.setTotal(convertMoney(src.getTotal())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim convertClaim(org.hl7.fhir.r4.model.Claim src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim tgt = new org.hl7.fhir.dstu3.model.Claim(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertClaimStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasUse()) -// tgt.setUse(convertUse(src.getUse())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasBillablePeriod()) -// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); -// if (src.hasCreated()) -// tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); -// if (src.hasEnterer()) -// tgt.setEnterer(convertReference(src.getEnterer())); -// if (src.hasInsurer()) -// tgt.setInsurer(convertReference(src.getInsurer())); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -//// if (src.hasOrganization()) -//// tgt.setOrganization(convertReference(src.getOrganization())); -// if (src.hasPriority()) -// tgt.setPriority(convertCodeableConcept(src.getPriority())); -// if (src.hasFundsReserve()) -// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); -// for (org.hl7.fhir.r4.model.Claim.RelatedClaimComponent t : src.getRelated()) -// tgt.addRelated(convertRelatedClaimComponent(t)); -// if (src.hasPrescription()) -// tgt.setPrescription(convertReference(src.getPrescription())); -// if (src.hasOriginalPrescription()) -// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); -// if (src.hasPayee()) -// tgt.setPayee(convertPayeeComponent(src.getPayee())); -// if (src.hasReferral()) -// tgt.setReferral(convertReference(src.getReferral())); -// if (src.hasFacility()) -// tgt.setFacility(convertReference(src.getFacility())); -// for (org.hl7.fhir.r4.model.Claim.CareTeamComponent t : src.getCareTeam()) -// tgt.addCareTeam(convertCareTeamComponent(t)); -// for (org.hl7.fhir.r4.model.Claim.SpecialConditionComponent t : src.getInformation()) -// tgt.addInformation(convertSpecialConditionComponent(t)); -// for (org.hl7.fhir.r4.model.Claim.DiagnosisComponent t : src.getDiagnosis()) -// tgt.addDiagnosis(convertDiagnosisComponent(t)); -// for (org.hl7.fhir.r4.model.Claim.ProcedureComponent t : src.getProcedure()) -// tgt.addProcedure(convertProcedureComponent(t)); -// for (org.hl7.fhir.r4.model.Claim.InsuranceComponent t : src.getInsurance()) -// tgt.addInsurance(convertInsuranceComponent(t)); -// if (src.hasAccident()) -// tgt.setAccident(convertAccidentComponent(src.getAccident())); -//// if (src.hasEmploymentImpacted()) -//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); -//// if (src.hasHospitalization()) -//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); -// for (org.hl7.fhir.r4.model.Claim.ItemComponent t : src.getItem()) -// tgt.addItem(convertItemComponent(t)); -// if (src.hasTotal()) -// tgt.setTotal(convertMoney(src.getTotal())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.dstu3.model.Claim.ClaimStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r4.model.Claim.ClaimStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r4.model.Claim.ClaimStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r4.model.Claim.ClaimStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.Claim.ClaimStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.Claim.ClaimStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.r4.model.Claim.ClaimStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.r4.model.Claim.Use convertUse(org.hl7.fhir.dstu3.model.Claim.Use src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPLETE: return org.hl7.fhir.r4.model.Claim.Use.CLAIM; -// case PROPOSED: return org.hl7.fhir.r4.model.Claim.Use.PREAUTHORIZATION; -// case EXPLORATORY: return org.hl7.fhir.r4.model.Claim.Use.PREDETERMINATION; -// default: return org.hl7.fhir.r4.model.Claim.Use.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Claim.Use convertUse(org.hl7.fhir.r4.model.Claim.Use src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case CLAIM: return org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE; -// case PREAUTHORIZATION: return org.hl7.fhir.dstu3.model.Claim.Use.PROPOSED; -// case PREDETERMINATION: return org.hl7.fhir.dstu3.model.Claim.Use.EXPLORATORY; -// default: return org.hl7.fhir.dstu3.model.Claim.Use.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r4.model.Claim.RelatedClaimComponent(); -// copyElement(src, tgt); -// if (src.hasClaim()) -// tgt.setClaim(convertReference(src.getClaim())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasReference()) -// tgt.setReference(convertIdentifier(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r4.model.Claim.RelatedClaimComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent(); -// copyElement(src, tgt); -// if (src.hasClaim()) -// tgt.setClaim(convertReference(src.getClaim())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasReference()) -// tgt.setReference(convertIdentifier(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.dstu3.model.Claim.PayeeComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r4.model.Claim.PayeeComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasResourceType()) -// tgt.setResource(convertCoding(src.getResourceType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r4.model.Claim.PayeeComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.PayeeComponent tgt = new org.hl7.fhir.dstu3.model.Claim.PayeeComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasResource()) -// tgt.setResourceType(convertCoding(src.getResource())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.dstu3.model.Claim.CareTeamComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r4.model.Claim.CareTeamComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasResponsible()) -// tgt.setResponsible(src.getResponsible()); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasQualification()) -// tgt.setQualification(convertCodeableConcept(src.getQualification())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r4.model.Claim.CareTeamComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.dstu3.model.Claim.CareTeamComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasResponsible()) -// tgt.setResponsible(src.getResponsible()); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasQualification()) -// tgt.setQualification(convertCodeableConcept(src.getQualification())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.r4.model.Claim.SpecialConditionComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// if (src.hasTiming()) -// tgt.setTiming(convertType(src.getTiming())); -// if (src.hasValue()) -// tgt.setValue(convertType(src.getValue())); -// if (src.hasReason()) -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.r4.model.Claim.SpecialConditionComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// if (src.hasTiming()) -// tgt.setTiming(convertType(src.getTiming())); -// if (src.hasValue()) -// tgt.setValue(convertType(src.getValue())); -// if (src.hasReason()) -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Claim.DiagnosisComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDiagnosis()) -// tgt.setDiagnosis(convertType(src.getDiagnosis())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// if (src.hasPackageCode()) -// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Claim.DiagnosisComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDiagnosis()) -// tgt.setDiagnosis(convertType(src.getDiagnosis())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// if (src.hasPackageCode()) -// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.dstu3.model.Claim.ProcedureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r4.model.Claim.ProcedureComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDateElement()) -// tgt.setDateElement(convertDateTime(src.getDateElement())); -// if (src.hasProcedure()) -// tgt.setProcedure(convertType(src.getProcedure())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r4.model.Claim.ProcedureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ProcedureComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDateElement()) -// tgt.setDateElement(convertDateTime(src.getDateElement())); -// if (src.hasProcedure()) -// tgt.setProcedure(convertType(src.getProcedure())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.dstu3.model.Claim.InsuranceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r4.model.Claim.InsuranceComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasFocal()) -// tgt.setFocal(src.getFocal()); -// if (src.hasCoverage()) -// tgt.setCoverage(convertReference(src.getCoverage())); -// if (src.hasBusinessArrangement()) -// tgt.setBusinessArrangement(src.getBusinessArrangement()); -// for (org.hl7.fhir.dstu3.model.StringType t : src.getPreAuthRef()) -// tgt.addPreAuthRef(t.getValue()); -// if (src.hasClaimResponse()) -// tgt.setClaimResponse(convertReference(src.getClaimResponse())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.Claim.InsuranceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.dstu3.model.Claim.InsuranceComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasFocal()) -// tgt.setFocal(src.getFocal()); -// if (src.hasCoverage()) -// tgt.setCoverage(convertReference(src.getCoverage())); -// if (src.hasBusinessArrangement()) -// tgt.setBusinessArrangement(src.getBusinessArrangement()); -// for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) -// tgt.addPreAuthRef(t.getValue()); -// if (src.hasClaimResponse()) -// tgt.setClaimResponse(convertReference(src.getClaimResponse())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.dstu3.model.Claim.AccidentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r4.model.Claim.AccidentComponent(); -// copyElement(src, tgt); -// if (src.hasDateElement()) -// tgt.setDateElement(convertDateTime(src.getDateElement())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r4.model.Claim.AccidentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.AccidentComponent tgt = new org.hl7.fhir.dstu3.model.Claim.AccidentComponent(); -// copyElement(src, tgt); -// if (src.hasDateElement()) -// tgt.setDateElement(convertDateTime(src.getDateElement())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.dstu3.model.Claim.ItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.ItemComponent tgt = new org.hl7.fhir.r4.model.Claim.ItemComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getCareTeamLinkId()) -// tgt.addCareTeamSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getDiagnosisLinkId()) -// tgt.addDiagnosisSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getProcedureLinkId()) -// tgt.addProcedureSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getInformationLinkId()) -// tgt.addInformationSequence(t.getValue()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasServiced()) -// tgt.setServiced(convertType(src.getServiced())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// if (src.hasBodySite()) -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubSite()) -// tgt.addSubSite(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getEncounter()) -// tgt.addEncounter(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Claim.DetailComponent t : src.getDetail()) -// tgt.addDetail(convertDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.Claim.ItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.ItemComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ItemComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// for (org.hl7.fhir.r4.model.PositiveIntType t : src.getCareTeamSequence()) -// tgt.addCareTeamLinkId(t.getValue()); -// for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDiagnosisSequence()) -// tgt.addDiagnosisLinkId(t.getValue()); -// for (org.hl7.fhir.r4.model.PositiveIntType t : src.getProcedureSequence()) -// tgt.addProcedureLinkId(t.getValue()); -// for (org.hl7.fhir.r4.model.PositiveIntType t : src.getInformationSequence()) -// tgt.addInformationLinkId(t.getValue()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasServiced()) -// tgt.setServiced(convertType(src.getServiced())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// if (src.hasBodySite()) -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) -// tgt.addSubSite(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) -// tgt.addEncounter(convertReference(t)); -// for (org.hl7.fhir.r4.model.Claim.DetailComponent t : src.getDetail()) -// tgt.addDetail(convertDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.dstu3.model.Claim.DetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.DetailComponent tgt = new org.hl7.fhir.r4.model.Claim.DetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Claim.SubDetailComponent t : src.getSubDetail()) -// tgt.addSubDetail(convertSubDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r4.model.Claim.DetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.DetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// for (org.hl7.fhir.r4.model.Claim.SubDetailComponent t : src.getSubDetail()) -// tgt.addSubDetail(convertSubDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.dstu3.model.Claim.SubDetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r4.model.Claim.SubDetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.Claim.SubDetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SubDetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// return tgt; -// } -// - public static org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ClinicalImpression tgt = new org.hl7.fhir.r4.model.ClinicalImpression(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasAssessor()) - tgt.setAssessor(convertReference(src.getAssessor())); - if (src.hasPrevious()) - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); - for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) - tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProtocol()) - tgt.addProtocol(t.getValue()); - if (src.hasSummary()) - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPrognosisCodeableConcept()) - tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPrognosisReference()) - tgt.addPrognosisReference(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r4.model.ClinicalImpression src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasAssessor()) - tgt.setAssessor(convertReference(src.getAssessor())); - if (src.hasPrevious()) - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.r4.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); - for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) - tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getProtocol()) - tgt.addProtocol(t.getValue()); - if (src.hasSummary()) - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPrognosisCodeableConcept()) - tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPrognosisReference()) - tgt.addPrognosisReference(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; - case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) - tgt.addItem(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r4.model.Reference t : src.getItem()) - tgt.addItem(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - tgt.setItemCodeableConcept(convertCodeableConcept(src.getItemCodeableConcept())); - if (src.hasItemReference()) - tgt.setItemReference(convertReference(src.getItemReference())); - if (src.hasBasis()) - tgt.setBasis(src.getBasis()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - tgt.setItem(convertType(src.getItemCodeableConcept())); - else if (src.hasItemReference()) - tgt.setItem(convertType(src.getItemReference())); - if (src.hasBasis()) - tgt.setBasis(src.getBasis()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasHierarchyMeaning()) - tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - if (src.hasContent()) - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasHierarchyMeaning()) - tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - if (src.hasContent()) - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUPEDBY: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; - case ISA: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; - case PARTOF: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; - case CLASSIFIEDWITH: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; - default: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUPEDBY: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; - case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; - case PARTOF: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; - case CLASSIFIEDWITH: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; - } -} - - private static org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getOperator()) - copyElement(t, tgt.addOperatorElement().setValue(convertFilterOperator(t.getValue()))); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getOperator()) - copyElement(t, tgt.addOperatorElement().setValue(convertFilterOperator(t.getValue()))); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EXISTS; - default: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.CodeSystem.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS; - default: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL; - } -} - - public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r4.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r4.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Communication tgt = new org.hl7.fhir.r4.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiatesCanonical(t.getReference()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasNotDone()) - tgt.setStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE); - else if (src.hasStatus()) - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - if (src.hasNotDoneReason()) - tgt.setStatusReason(convertCodeableConcept(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasSent()) - tgt.setSentElement(convertDateTime(src.getSentElement())); - if (src.hasReceived()) - tgt.setReceivedElement(convertDateTime(src.getReceivedElement())); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r4.model.Communication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesCanonical()) - tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - if (src.getStatus() == org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE) - tgt.setNotDone(true); - else - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - if (src.hasStatusReason()) - tgt.setNotDoneReason(convertCodeableConcept(src.getStatusReason())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasSent()) - tgt.setSentElement(convertDateTime(src.getSentElement())); - if (src.hasReceived()) - tgt.setReceivedElement(convertDateTime(src.getReceivedElement())); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.PREPARATION; - case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; - case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ONHOLD; - case ABORTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.STOPPED; - case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.PREPARATION; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - if (src.hasContent()) - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - if (src.hasContent()) - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public static org.hl7.fhir.r4.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CompartmentDefinition tgt = new org.hl7.fhir.r4.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCompartmentType(src.getCode())); - if (src.hasSearch()) - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r4.model.CompartmentDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCompartmentType(src.getCode())); - if (src.hasSearch()) - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasClass_()) - tgt.addCategory(convertCodeableConcept(src.getClass_())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasConfidentiality()) - tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); - for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasConfidentiality()) - tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); - for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); - for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case U: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.U; - case L: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.L; - case M: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.M; - case N: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.N; - case R: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.R; - case V: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.V; - default: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case U: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U; - case L: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L; - case M: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M; - case N: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N; - case R: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R; - case V: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V; - default: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL; - } -} - - public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); - if (src.hasTime()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasParty()) - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.addMode(convertCompositionAttestationMode(src.getMode())); - if (src.hasTime()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasParty()) - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); - copyElement(src, tgt); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - if (src.hasMode()) - tgt.setMode(convertSectionMode(src.getMode())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); - copyElement(src, tgt); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - if (src.hasMode()) - tgt.setMode(convertSectionMode(src.getMode())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.dstu3.model.Composition.SectionMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r4.model.Composition.SectionMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r4.model.Composition.SectionMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r4.model.Composition.SectionMode.CHANGES; - default: return org.hl7.fhir.r4.model.Composition.SectionMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r4.model.Composition.SectionMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasSource()) { - org.hl7.fhir.r4.model.Type t = convertType(src.getSource()); - tgt.setSource(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); - } - if (src.hasTarget()) { - org.hl7.fhir.r4.model.Type t = convertType(src.getTarget()); - tgt.setTarget(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); - } - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertConceptMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasSource()) - tgt.setSource(convertType(src.getSource())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertConceptMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setSource(src.getSource()); - if (src.hasSourceVersion()) - tgt.setSourceVersion(src.getSourceVersion()); - if (src.hasTarget()) - tgt.setTarget(src.getTarget()); - if (src.hasTargetVersion()) - tgt.setTargetVersion(src.getTargetVersion()); - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) - tgt.addElement(convertSourceElementComponent(t)); - if (src.hasUnmapped()) - tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setSource(src.getSource()); - if (src.hasSourceVersion()) - tgt.setSourceVersion(src.getSourceVersion()); - if (src.hasTarget()) - tgt.setTarget(src.getTarget()); - if (src.hasTargetVersion()) - tgt.setTargetVersion(src.getTargetVersion()); - for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : src.getElement()) - tgt.addElement(convertSourceElementComponent(t)); - if (src.hasUnmapped()) - tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasEquivalence()) - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasEquivalence()) - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RELATEDTO: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.RELATEDTO; - case EQUIVALENT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RELATEDTO: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.RELATEDTO; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } -} - - public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setValue(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setCode(src.getValue()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVIDED: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; - case FIXED: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; - case OTHERMAP: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; - default: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVIDED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; - case FIXED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; - case OTHERMAP: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; - default: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Condition tgt = new org.hl7.fhir.r4.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasSeverity()) - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAbatement()) - tgt.setAbatement(convertType(src.getAbatement())); - if (src.hasAssertedDate()) - tgt.setRecordedDateElement(convertDateTime(src.getAssertedDateElement())); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasStage()) - tgt.addStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.r4.model.Condition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasSeverity()) - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAbatement()) - tgt.setAbatement(convertType(src.getAbatement())); - if (src.hasRecordedDate()) - tgt.setAssertedDate(src.getRecordedDate()); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasStage()) - tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); - for (org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static final String CODE_SYSTEM_CONDITION_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-clinical"; - private static final String CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL = "http://hl7.org/fhir/condition-clinical"; - - private static org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); - switch (src) { - case ACTIVE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("active"); - return cc; - case RECURRENCE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("recurrence"); - return cc; - case INACTIVE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("inactive"); - return cc; - case REMISSION: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("remission"); - return cc; - case RESOLVED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("resolved"); - return cc; - default: return null; - } - } - - private static org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus convertConditionClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "active") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "active")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.ACTIVE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "recurrence") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "recurrence")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RECURRENCE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "inactive") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "inactive")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.INACTIVE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "remission") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "remission")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.REMISSION; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "resolved") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "resolved")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RESOLVED; - return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.NULL; - } - - private static final String CODE_SYSTEM_CONDITION_VER_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-ver-status"; - private static final String CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL = "http://hl7.org/fhir/condition-ver-status"; - - private static org.hl7.fhir.r4.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); - switch (src) { - case PROVISIONAL: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("provisional"); - return cc; - case DIFFERENTIAL: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("differential"); - return cc; - case CONFIRMED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("confirmed"); - return cc; - case REFUTED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("refuted"); - return cc; - case ENTEREDINERROR: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("entered-in-error"); - return cc; - default: return null; - } - } - - private static org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "provisional") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "provisional")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "differential") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "differential")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "confirmed") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "confirmed")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "refuted") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "refuted")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "entered-in-error") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "entered-in-error")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; - } - - public static org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - if (src.hasSummary()) - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - if (src.hasSummary()) - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent tgt = new org.hl7.fhir.r4.model.Consent(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertConsentState(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDateTime()) - tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getConsentingParty()) - tgt.addPerformer(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getOrganization()) - tgt.addOrganization(convertReference(t)); - if (src.hasSource()) - tgt.setSource(convertType(src.getSource())); - for (org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent t : src.getPolicy()) - tgt.addPolicy(convertConsentPolicyComponent(t)); - if (src.hasPolicyRule()) { - org.hl7.fhir.r4.model.Coding c = new org.hl7.fhir.r4.model.Coding(); - c.setSystem(URN_IETF_RFC_3986); - c.setCode(src.getPolicyRule()); - tgt.setPolicyRule(new CodeableConcept(c)); - } - - if (src.hasSecurityLabel() || src.hasPeriod() || src.hasActor() || src.hasAction() || src.hasPurpose() || src.hasDataPeriod() || src.hasData() || src.hasExcept()) { - - org.hl7.fhir.r4.model.Consent.provisionComponent pc = new org.hl7.fhir.r4.model.Consent.provisionComponent(); - - if (src.hasPeriod()) - pc.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent t : src.getActor()) - pc.addActor(convertConsentActorComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - pc.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - pc.addSecurityLabel(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) - pc.addPurpose(convertCoding(t)); - if (src.hasDataPeriod()) - pc.setDataPeriod(convertPeriod(src.getDataPeriod())); - for (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent t : src.getData()) - pc.addData(convertConsentDataComponent(t)); - for (org.hl7.fhir.dstu3.model.Consent.ExceptComponent t : src.getExcept()) - pc.addProvision(convertExceptComponent(t)); - - tgt.setProvision(pc); - } - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r4.model.Consent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent(); - copyDomainResource(src, tgt); - List identifier = src.getIdentifier(); - if (identifier.size() > 0) { - tgt.setIdentifier(convertIdentifier(identifier.get(0))); - if (identifier.size() > 1) { - // TODO print a warning that only one identifier could be converted - } - } - if (src.hasStatus()) - tgt.setStatus(convertConsentState(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDateTime()) - - tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) - tgt.addConsentingParty(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getOrganization()) - tgt.addOrganization(convertReference(t)); - if (src.hasSource()) - tgt.setSource(convertType(src.getSource())); - for (org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent t : src.getPolicy()) - tgt.addPolicy(convertConsentPolicyComponent(t)); - if (src.hasPolicyRule()) { - for (org.hl7.fhir.r4.model.Coding c : src.getPolicyRule().getCoding()) { - // assuming that there is only a single value of this specific value - if (URN_IETF_RFC_3986.equals(c.getSystem())) { - tgt.setPolicyRule(c.getCode()); - break; + public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src, boolean b) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); } - } + return res; } - if (src.hasProvision()) { - org.hl7.fhir.r4.model.Consent.provisionComponent p = src.getProvision(); - if (p.hasPeriod()) - tgt.setPeriod(convertPeriod(p.getPeriod())); - for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : p.getActor()) - tgt.addActor(convertConsentActorComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : p.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Coding t : p.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : p.getPurpose()) - tgt.addPurpose(convertCoding(t)); - if (p.hasDataPeriod()) - tgt.setDataPeriod(convertPeriod(p.getDataPeriod())); - for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : p.getData()) - tgt.addData(convertConsentDataComponent(t)); - for (org.hl7.fhir.r4.model.Consent.provisionComponent t : p.getProvision()) - tgt.addExcept(convertExceptComponent(t)); + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ClinicalImpression", "CodeSystem", "Communication", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "DetectedIssue", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "Endpoint", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImplementationGuide", "Library", "Linkage", "ListResource", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "PaymentNotice", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "TestReport", "TestScript", "ValueSet"); } - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.ConsentState convertConsentState(org.hl7.fhir.dstu3.model.Consent.ConsentState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: - return org.hl7.fhir.r4.model.Consent.ConsentState.DRAFT; - case PROPOSED: - return org.hl7.fhir.r4.model.Consent.ConsentState.PROPOSED; - case ACTIVE: - return org.hl7.fhir.r4.model.Consent.ConsentState.ACTIVE; - case REJECTED: - return org.hl7.fhir.r4.model.Consent.ConsentState.REJECTED; - case INACTIVE: - return org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE; - case ENTEREDINERROR: - return org.hl7.fhir.r4.model.Consent.ConsentState.ENTEREDINERROR; - default: - return org.hl7.fhir.r4.model.Consent.ConsentState.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r4.model.Consent.ConsentState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.DRAFT; - case PROPOSED: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.PROPOSED; - case ACTIVE: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.ACTIVE; - case REJECTED: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.REJECTED; - case INACTIVE: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.INACTIVE; - case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.ENTEREDINERROR; - default: - return org.hl7.fhir.dstu3.model.Consent.ConsentState.NULL; - } - } - - private static org.hl7.fhir.r4.model.Consent.provisionActorComponent convertConsentActorComponent(org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent(); - copyElement(src, tgt); - if (src.hasAuthority()) - tgt.setAuthority(src.getAuthority()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent(); - copyElement(src, tgt); - if (src.hasAuthority()) - tgt.setAuthority(src.getAuthority()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.provisionDataComponent convertConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); - copyElement(src, tgt); - if (src.hasMeaning()) - tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent(); - copyElement(src, tgt); - if (src.hasMeaning()) - tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: - return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.INSTANCE; - case RELATED: - return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.RELATED; - case DEPENDENTS: - return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.DEPENDENTS; - case AUTHOREDBY: - return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.AUTHOREDBY; - default: - return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: - return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE; - case RELATED: - return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED; - case DEPENDENTS: - return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS; - case AUTHOREDBY: - return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY; - default: - return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL; - } - } - - private static org.hl7.fhir.r4.model.Consent.provisionComponent convertExceptComponent(org.hl7.fhir.dstu3.model.Consent.ExceptComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.provisionComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertConsentExceptType(src.getType())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent t : src.getActor()) - tgt.addActor(convertExceptActorComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) - tgt.addPurpose(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getClass_()) - tgt.addClass_(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(new CodeableConcept(convertCoding(t))); - if (src.hasDataPeriod()) - tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); - for (org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent t : src.getData()) - tgt.addData(convertExceptDataComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.r4.model.Consent.provisionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ExceptComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertConsentExceptType(src.getType())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : src.getActor()) - tgt.addActor(convertExceptActorComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getPurpose()) - tgt.addPurpose(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getClass_()) - tgt.addClass_(convertCoding(t)); - for (CodeableConcept t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasDataPeriod()) - tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); - for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : src.getData()) - tgt.addData(convertExceptDataComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.ConsentProvisionType convertConsentExceptType(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DENY: - return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.DENY; - case PERMIT: - return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.PERMIT; - default: - return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.r4.model.Consent.ConsentProvisionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DENY: - return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.DENY; - case PERMIT: - return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.PERMIT; - default: - return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.NULL; - } - } - - private static org.hl7.fhir.r4.model.Consent.provisionActorComponent convertExceptActorComponent(org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Consent.provisionDataComponent convertExceptDataComponent(org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); - copyElement(src, tgt); - if (src.hasMeaning()) - tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent(); - copyElement(src, tgt); - if (src.hasMeaning()) - tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); - if (src.hasReference()) - tgt.setReference(convertReference(src.getReference())); - return tgt; - } -// -// public static org.hl7.fhir.r4.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract tgt = new org.hl7.fhir.r4.model.Contract(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertContractStatus(src.getStatus())); -// if (src.hasIssued()) -// tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasContentDerivative()) -// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); -// for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) -// tgt.setRule(convertComputableLanguageComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.r4.model.Contract src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertContractStatus(src.getStatus())); -// if (src.hasIssued()) -// tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasContentDerivative()) -// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); -// for (org.hl7.fhir.r4.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// if (src.hasRule()) -// tgt.addRule(convertComputableLanguageComponent(src.getRule())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.dstu3.model.Contract.ContractStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AMENDED: return org.hl7.fhir.r4.model.Contract.ContractStatus.AMENDED; -// case APPENDED: return org.hl7.fhir.r4.model.Contract.ContractStatus.APPENDED; -// case CANCELLED: return org.hl7.fhir.r4.model.Contract.ContractStatus.CANCELLED; -// case DISPUTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.DISPUTED; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.Contract.ContractStatus.ENTEREDINERROR; -// case EXECUTABLE: return org.hl7.fhir.r4.model.Contract.ContractStatus.EXECUTABLE; -// case EXECUTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.EXECUTED; -// case NEGOTIABLE: return org.hl7.fhir.r4.model.Contract.ContractStatus.NEGOTIABLE; -// case OFFERED: return org.hl7.fhir.r4.model.Contract.ContractStatus.OFFERED; -// case POLICY: return org.hl7.fhir.r4.model.Contract.ContractStatus.POLICY; -// case REJECTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.REJECTED; -// case RENEWED: return org.hl7.fhir.r4.model.Contract.ContractStatus.RENEWED; -// case REVOKED: return org.hl7.fhir.r4.model.Contract.ContractStatus.REVOKED; -// case RESOLVED: return org.hl7.fhir.r4.model.Contract.ContractStatus.RESOLVED; -// case TERMINATED: return org.hl7.fhir.r4.model.Contract.ContractStatus.TERMINATED; -// default: return org.hl7.fhir.r4.model.Contract.ContractStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.r4.model.Contract.ContractStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AMENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.AMENDED; -// case APPENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.APPENDED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.CANCELLED; -// case DISPUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.DISPUTED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.ENTEREDINERROR; -// case EXECUTABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTABLE; -// case EXECUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTED; -// case NEGOTIABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NEGOTIABLE; -// case OFFERED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.OFFERED; -// case POLICY: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.POLICY; -// case REJECTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REJECTED; -// case RENEWED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RENEWED; -// case REVOKED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REVOKED; -// case RESOLVED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RESOLVED; -// case TERMINATED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.TERMINATED; -// default: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCoding(src.getType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCoding(src.getType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent(); -// copyElement(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasIssued()) -// tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubType()) -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); -// copyElement(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasIssued()) -// tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubType()) -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.Coverage convertCoverage(org.hl7.fhir.dstu3.model.Coverage src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Coverage tgt = new org.hl7.fhir.r4.model.Coverage(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertCoverageStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasPolicyHolder()) -// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); -// if (src.hasSubscriber()) -// tgt.setSubscriber(convertReference(src.getSubscriber())); -// if (src.hasSubscriberId()) -// tgt.setSubscriberId(src.getSubscriberId()); -// if (src.hasBeneficiary()) -// tgt.setBeneficiary(convertReference(src.getBeneficiary())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getPayor()) -// tgt.addPayor(convertReference(t)); -// if (src.hasGrouping()) -// tgt.setGrouping(convertGroupComponent(src.getGrouping())); -// if (src.hasDependent()) -// tgt.setDependent(src.getDependent()); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasOrder()) -// tgt.setOrder(src.getOrder()); -// if (src.hasNetwork()) -// tgt.setNetwork(src.getNetwork()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getContract()) -// tgt.addContract(convertReference(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Coverage convertCoverage(org.hl7.fhir.r4.model.Coverage src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Coverage tgt = new org.hl7.fhir.dstu3.model.Coverage(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertCoverageStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasPolicyHolder()) -// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); -// if (src.hasSubscriber()) -// tgt.setSubscriber(convertReference(src.getSubscriber())); -// if (src.hasSubscriberId()) -// tgt.setSubscriberId(src.getSubscriberId()); -// if (src.hasBeneficiary()) -// tgt.setBeneficiary(convertReference(src.getBeneficiary())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r4.model.Reference t : src.getPayor()) -// tgt.addPayor(convertReference(t)); -// if (src.hasGrouping()) -// tgt.setGrouping(convertGroupComponent(src.getGrouping())); -// if (src.hasDependent()) -// tgt.setDependent(src.getDependent()); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasOrder()) -// tgt.setOrder(src.getOrder()); -// if (src.hasNetwork()) -// tgt.setNetwork(src.getNetwork()); -// for (org.hl7.fhir.r4.model.Reference t : src.getContract()) -// tgt.addContract(convertReference(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.dstu3.model.Coverage.CoverageStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.r4.model.Coverage.CoverageStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.dstu3.model.Coverage.GroupComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Coverage.GroupComponent tgt = new org.hl7.fhir.r4.model.Coverage.GroupComponent(); -// copyElement(src, tgt); -// if (src.hasGroup()) -// tgt.setGroup(src.getGroup()); -// if (src.hasGroupDisplay()) -// tgt.setGroupDisplay(src.getGroupDisplay()); -// if (src.hasSubGroup()) -// tgt.setSubGroup(src.getSubGroup()); -// if (src.hasSubGroupDisplay()) -// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); -// if (src.hasPlan()) -// tgt.setPlan(src.getPlan()); -// if (src.hasPlanDisplay()) -// tgt.setPlanDisplay(src.getPlanDisplay()); -// if (src.hasSubPlan()) -// tgt.setSubPlan(src.getSubPlan()); -// if (src.hasSubPlanDisplay()) -// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); -// if (src.hasClass_()) -// tgt.setClass_(src.getClass_()); -// if (src.hasClassDisplay()) -// tgt.setClassDisplay(src.getClassDisplay()); -// if (src.hasSubClass()) -// tgt.setSubClass(src.getSubClass()); -// if (src.hasSubClassDisplay()) -// tgt.setSubClassDisplay(src.getSubClassDisplay()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.r4.model.Coverage.GroupComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Coverage.GroupComponent tgt = new org.hl7.fhir.dstu3.model.Coverage.GroupComponent(); -// copyElement(src, tgt); -// if (src.hasGroup()) -// tgt.setGroup(src.getGroup()); -// if (src.hasGroupDisplay()) -// tgt.setGroupDisplay(src.getGroupDisplay()); -// if (src.hasSubGroup()) -// tgt.setSubGroup(src.getSubGroup()); -// if (src.hasSubGroupDisplay()) -// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); -// if (src.hasPlan()) -// tgt.setPlan(src.getPlan()); -// if (src.hasPlanDisplay()) -// tgt.setPlanDisplay(src.getPlanDisplay()); -// if (src.hasSubPlan()) -// tgt.setSubPlan(src.getSubPlan()); -// if (src.hasSubPlanDisplay()) -// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); -// if (src.hasClass_()) -// tgt.setClass_(src.getClass_()); -// if (src.hasClassDisplay()) -// tgt.setClassDisplay(src.getClassDisplay()); -// if (src.hasSubClass()) -// tgt.setSubClass(src.getSubClass()); -// if (src.hasSubClassDisplay()) -// tgt.setSubClassDisplay(src.getSubClassDisplay()); -// return tgt; -// } -// - public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); -// if (src.hasStringency()) -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.getSnapshot().addElement(convertElementDefinition(t)); - tgt.setKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); -// copyDomainResource(src, tgt); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasStatus()) -// tgt.setStatus(convertPublicationStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// if (src.hasDateElement()) -// tgt.setDateElement(convertDateTime(src.getDateElement())); -// if (src.hasPublisher()) -// tgt.setPublisher(src.getPublisher()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasTitle()) -// tgt.setTitle(src.getTitle()); -// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertContactDetail(t)); -// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) -// tgt.addUseContext(convertUsageContext(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addJurisdiction(convertCodeableConcept(t)); -// if (src.hasCopyright()) -// tgt.setCopyright(src.getCopyright()); -// if (src.hasStringency()) -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } - -// private static org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; -// } -//} - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - -// public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// if (src.hasIdentity()) -// tgt.setIdentity(src.getIdentity()); -// if (src.hasUri()) -// tgt.setUri(src.getUri()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasComment()) -// tgt.setComment(src.getComment()); -// return tgt; -// } - - public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCode(convertCodeableConcept(src.getCategory())); - if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDateElement()) - tgt.setIdentified(convertDateTime(src.getDateElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - if (src.hasReference()) - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasStatus()) - tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); - if (src.hasCode()) - tgt.setCategory(convertCodeableConcept(src.getCode())); - if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasIdentifiedDateTimeType()) - tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - if (src.hasReference()) - tgt.setReference(src.getReference()); - for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; - } -} - - public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - if (src.hasAction()) - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - if (src.hasAction()) - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - -// public static org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Device tgt = new org.hl7.fhir.r4.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); -// if (src.hasStatus()) -// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLotNumber()) -// tgt.setLotNumber(src.getLotNumber()); -// if (src.hasManufacturer()) -// tgt.setManufacturer(src.getManufacturer()); -// if (src.hasManufactureDate()) -// tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement())); -// if (src.hasExpirationDate()) -// tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); -// if (src.hasModel()) -// tgt.setModel(src.getModel()); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasOwner()) -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasLocation()) -// tgt.setLocation(convertReference(src.getLocation())); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSafety()) -// tgt.addSafety(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.r4.model.Device src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); -// if (src.hasStatus()) -// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLotNumber()) -// tgt.setLotNumber(src.getLotNumber()); -// if (src.hasManufacturer()) -// tgt.setManufacturer(src.getManufacturer()); -// if (src.hasManufactureDate()) -// tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement())); -// if (src.hasExpirationDate()) -// tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); -// if (src.hasModel()) -// tgt.setModel(src.getModel()); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasOwner()) -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasLocation()) -// tgt.setLocation(convertReference(src.getLocation())); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSafety()) -// tgt.addSafety(convertCodeableConcept(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE; -// case INACTIVE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// case UNKNOWN: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.UNKNOWN; -// default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; -// case INACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.UNKNOWN; -// default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.r4.model.Device.DeviceUdiComponent(); -// copyElement(src, tgt); -// if (src.hasDeviceIdentifier()) -// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasJurisdiction()) -// tgt.setJurisdiction(src.getJurisdiction()); -// if (src.hasCarrierHRF()) -// tgt.setCarrierHRF(src.getCarrierHRF()); -// if (src.hasCarrierAIDC()) -// tgt.setCarrierAIDC(src.getCarrierAIDC()); -// if (src.hasIssuer()) -// tgt.setIssuer(src.getIssuer()); -// if (src.hasEntryType()) -// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.r4.model.Device.DeviceUdiComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent(); -// copyElement(src, tgt); -// if (src.hasDeviceIdentifier()) -// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasJurisdiction()) -// tgt.setJurisdiction(src.getJurisdiction()); -// if (src.hasCarrierHRF()) -// tgt.setCarrierHRF(src.getCarrierHRF()); -// if (src.hasCarrierAIDC()) -// tgt.setCarrierAIDC(src.getCarrierAIDC()); -// if (src.hasIssuer()) -// tgt.setIssuer(src.getIssuer()); -// if (src.hasEntryType()) -// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.dstu3.model.Device.UDIEntryType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BARCODE: return org.hl7.fhir.r4.model.Device.UDIEntryType.BARCODE; -// case RFID: return org.hl7.fhir.r4.model.Device.UDIEntryType.RFID; -// case MANUAL: return org.hl7.fhir.r4.model.Device.UDIEntryType.MANUAL; -// case CARD: return org.hl7.fhir.r4.model.Device.UDIEntryType.CARD; -// case SELFREPORTED: return org.hl7.fhir.r4.model.Device.UDIEntryType.SELFREPORTED; -// case UNKNOWN: return org.hl7.fhir.r4.model.Device.UDIEntryType.UNKNOWN; -// default: return org.hl7.fhir.r4.model.Device.UDIEntryType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.r4.model.Device.UDIEntryType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BARCODE: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.BARCODE; -// case RFID: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.RFID; -// case MANUAL: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.MANUAL; -// case CARD: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.CARD; -// case SELFREPORTED: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.SELFREPORTED; -// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.UNKNOWN; -// default: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DeviceComponent tgt = new org.hl7.fhir.r4.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLastSystemChange()) -// tgt.setLastSystemChange(src.getLastSystemChange()); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// if (src.hasParameterGroup()) -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// if (src.hasMeasurementPrinciple()) -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// if (src.hasLanguageCode()) -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r4.model.DeviceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLastSystemChange()) -// tgt.setLastSystemChange(src.getLastSystemChange()); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// if (src.hasParameterGroup()) -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// if (src.hasMeasurementPrinciple()) -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// if (src.hasLanguageCode()) -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// if (src.hasSpecType()) -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// if (src.hasComponentId()) -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// if (src.hasProductionSpec()) -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// if (src.hasSpecType()) -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// if (src.hasComponentId()) -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// if (src.hasProductionSpec()) -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DeviceMetric tgt = new org.hl7.fhir.r4.model.DeviceMetric(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasUnit()) -// tgt.setUnit(convertCodeableConcept(src.getUnit())); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// if (src.hasOperationalStatus()) -// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); -// if (src.hasColor()) -// tgt.setColor(convertDeviceMetricColor(src.getColor())); -// if (src.hasCategory()) -// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); -// if (src.hasMeasurementPeriod()) -// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); -// for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) -// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r4.model.DeviceMetric src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasUnit()) -// tgt.setUnit(convertCodeableConcept(src.getUnit())); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// if (src.hasOperationalStatus()) -// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); -// if (src.hasColor()) -// tgt.setColor(convertDeviceMetricColor(src.getColor())); -// if (src.hasCategory()) -// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); -// if (src.hasMeasurementPeriod()) -// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); -// for (org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) -// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; -// case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; -// case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; -// case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; -// case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BLACK: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLACK; -// case RED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.RED; -// case GREEN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.GREEN; -// case YELLOW: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.YELLOW; -// case BLUE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLUE; -// case MAGENTA: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.MAGENTA; -// case CYAN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.CYAN; -// case WHITE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.WHITE; -// default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; -// case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; -// case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; -// case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; -// case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; -// case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; -// case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; -// case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; -// } -//} -// -// private static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; -// case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; -// case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; -// case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; -// default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; -// case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; -// case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); -// if (src.hasState()) -// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); -// if (src.hasTime()) -// tgt.setTimeElement(convertDateTime(src.getTimeElement())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); -// if (src.hasState()) -// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); -// if (src.hasTime()) -// tgt.setTimeElement(convertDateTime(src.getTimeElement())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; -// case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; -// case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; -// case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; -// default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; -// case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; -// case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; -// case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; -// } -//} -// -// private static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; -// case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; -// case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; -// case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; -// default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; -// case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; -// case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; -// } -//} -// - - public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasRecordedOn()) - tgt.setRecordedOnElement(convertDateTime(src.getRecordedOnElement())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) - tgt.addReasonCode(convertCodeableConcept(t)); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasRecordedOn()) - tgt.setRecordedOnElement(convertDateTime(src.getRecordedOnElement())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addIndication(convertCodeableConcept(t)); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; - default: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; - default: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DiagnosticReport tgt = new org.hl7.fhir.r4.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssuedElement(convertInstant(src.getIssuedElement())); -// for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) -// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addMedia(convertDiagnosticReportImageComponent(t)); - if (src.hasConclusion()) - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addConclusionCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssuedElement(convertInstant(src.getIssuedElement())); -// for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) -// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - if (src.hasConclusion()) - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getConclusionCode()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case PRELIMINARY: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } -} - -// public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportPerformerComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// return tgt; -// } -// - public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent(); - copyElement(src, tgt); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasLink()) - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasLink()) - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - -// public static org.hl7.fhir.r4.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DocumentManifest tgt = new org.hl7.fhir.r4.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// if (src.hasMasterIdentifier()) -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); -// if (src.hasCreated()) -// tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) -// tgt.addAgent().setWho(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(src.getSource()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r4.model.DocumentManifest src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// if (src.hasMasterIdentifier()) -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); -// if (src.hasCreated()) -// tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(src.getSource()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } - - private static org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; - } -} -// -// public static org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// if (src.hasP()) -// tgt.setP(convertType(src.getP())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// if (src.hasP()) -// tgt.setP(convertType(src.getP())); -// return tgt; -// } - - public static org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasRef()) - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasRef()) - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public static org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference(); - copyDomainResource(src, tgt); - if (src.hasMasterIdentifier()) - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - if (src.hasDocStatus()) - tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasClass_()) - tgt.addCategory(convertCodeableConcept(src.getClass_())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setDateElement(convertDateTimeToInstant(src.getCreatedElement())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - if (src.hasAuthenticator()) - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - if (src.hasContext()) - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); - copyDomainResource(src, tgt); - if (src.hasMasterIdentifier()) - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - if (src.hasDocStatus()) - tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasDateElement()) - tgt.setCreatedElement(convertInstantToDateTime(src.getDateElement())); -// for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - if (src.hasAuthenticator()) - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - if (src.hasContext()) - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private static org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - private static org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; - } -} - - - public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - if (src.hasAttachment()) - tgt.setAttachment(convertAttachment(src.getAttachment())); - if (src.hasFormat()) - tgt.setFormat(convertCoding(src.getFormat())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - if (src.hasAttachment()) - tgt.setAttachment(convertAttachment(src.getAttachment())); - if (src.hasFormat()) - tgt.setFormat(convertCoding(src.getFormat())); - return tgt; - } - - public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.addEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasFacilityType()) - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - if (src.hasPracticeSetting()) - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - if (src.hasSourcePatientInfo()) - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounterFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasFacilityType()) - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - if (src.hasPracticeSetting()) - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - if (src.hasSourcePatientInfo()) - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.r4.model.Reference t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Reference tgt = convertReference(src.getRef()); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertStatusHistoryComponent(t)); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) - tgt.addClassHistory(convertClassHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - if (src.hasAppointment()) - tgt.addAppointment(convertReference(src.getAppointment())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasLength()) - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - if (src.hasHospitalization()) - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - if (src.hasServiceProvider()) - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertStatusHistoryComponent(t)); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - for (org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) - tgt.addClassHistory(convertClassHistoryComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasLength()) - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - if (src.hasHospitalization()) - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - if (src.hasServiceProvider()) - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; - case TRIAGED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.TRIAGED; - case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; - case TRIAGED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.TRIAGED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent(); - copyElement(src, tgt); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); - copyElement(src, tgt); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIndividual()) - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIndividual()) - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Encounter.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setUse(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Encounter.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasUse()) - tgt.setRole(convertCodeableConcept(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - if (src.hasPreAdmissionIdentifier()) - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - if (src.hasOrigin()) - tgt.setOrigin(convertReference(src.getOrigin())); - if (src.hasAdmitSource()) - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - if (src.hasReAdmission()) - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - if (src.hasDischargeDisposition()) - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - if (src.hasPreAdmissionIdentifier()) - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - if (src.hasOrigin()) - tgt.setOrigin(convertReference(src.getOrigin())); - if (src.hasAdmitSource()) - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - if (src.hasReAdmission()) - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - if (src.hasDischargeDisposition()) - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Endpoint convertEndpoint(org.hl7.fhir.dstu3.model.Endpoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Endpoint tgt = new org.hl7.fhir.r4.model.Endpoint(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEndpointStatus(src.getStatus())); - if (src.hasConnectionType()) - tgt.setConnectionType(convertCoding(src.getConnectionType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPayloadType()) - tgt.addPayloadType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getPayloadMimeType()) - tgt.addPayloadMimeType(t.getValue()); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Endpoint convertEndpoint(org.hl7.fhir.r4.model.Endpoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Endpoint tgt = new org.hl7.fhir.dstu3.model.Endpoint(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEndpointStatus(src.getStatus())); - if (src.hasConnectionType()) - tgt.setConnectionType(convertCoding(src.getConnectionType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPayloadType()) - tgt.addPayloadType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeType t : src.getPayloadMimeType()) - tgt.addPayloadMimeType(t.getValue()); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.SUSPENDED; - case ERROR: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ERROR; - case OFF: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.OFF; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ENTEREDINERROR; - case TEST: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.TEST; - default: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r4.model.Endpoint.EndpointStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.SUSPENDED; - case ERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ERROR; - case OFF: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.OFF; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ENTEREDINERROR; - case TEST: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.TEST; - default: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.EpisodeOfCare tgt = new org.hl7.fhir.r4.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - if (src.hasCareManager()) - tgt.setCareManager(convertReference(src.getCareManager())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTeam()) - tgt.addTeam(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r4.model.EpisodeOfCare src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r4.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - if (src.hasCareManager()) - tgt.setCareManager(convertReference(src.getCareManager())); - for (org.hl7.fhir.r4.model.Reference t : src.getTeam()) - tgt.addTeam(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Parameters convertExpansionProfile(org.hl7.fhir.dstu3.model.ExpansionProfile src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); - if (src.hasUrl()) - tgt.addParameter("profile-url", src.getUrl()); - if (src.hasVersion()) - tgt.addParameter("profile-version", src.getVersion()); - if (src.hasName()) - tgt.addParameter("profile-name", src.getName()); - if (src.hasStatus()) - tgt.addParameter("profile-status", src.getStatus().toCode()); - - for (org.hl7.fhir.dstu3.model.ExpansionProfile.ExpansionProfileFixedVersionComponent t : src.getFixedVersion()) { - if (t.getMode() == SystemVersionProcessingMode.DEFAULT) - tgt.addParameter("system-version", t.getSystem()+"|"+t.getVersion()); - else if (t.getMode() == SystemVersionProcessingMode.CHECK) - tgt.addParameter("check-system-version", t.getSystem()+"|"+t.getVersion()); - else if (t.getMode() == SystemVersionProcessingMode.OVERRIDE) - tgt.addParameter("force-system-version", t.getSystem()+"|"+t.getVersion()); - } - - if (src.hasExcludedSystem()) { - tgt.addParameter("exclude-system", src.getExcludedSystem().getSystem()+"|"+src.getExcludedSystem().getVersion()); - } - if (src.hasIncludeDesignations()) - tgt.addParameter("includeDesignations", src.getIncludeDesignations()); - - for (DesignationIncludeDesignationComponent t : src.getDesignation().getInclude().getDesignation()) { - if (t.hasLanguage()) - tgt.addParameter("designation", "urn:ietf:bcp:47|"+t.getLanguage()); - if (t.hasUse()) - tgt.addParameter("designation", t.getUse().getSystem()+"|"+t.getUse().getCode()); - } - if (src.hasIncludeDefinition()) - tgt.addParameter("includeDefinition", src.getIncludeDefinition()); - if (src.hasActiveOnly()) - tgt.addParameter("activeOnly", src.getActiveOnly()); - if (src.hasExcludeNested()) - tgt.addParameter("excludeNested", src.getExcludeNested()); - if (src.hasExcludeNotForUI()) - tgt.addParameter("excludeNotForUI", src.getExcludeNotForUI()); - if (src.hasExcludePostCoordinated()) - tgt.addParameter("excludePostCoordinated", src.getExcludePostCoordinated()); - if (src.hasDisplayLanguage()) - tgt.addParameter("excludePostCoordinated", src.getDisplayLanguage()); - if (src.hasLimitedExpansion()) - tgt.addParameter("limitedExpansion", src.getLimitedExpansion()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ExpansionProfile convertExpansionProfile(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile(); - if (src.hasParameter("profile-url")) - tgt.setUrl(src.getParameter("profile-url").primitiveValue()); - if (src.hasParameter("profile-version")) - tgt.setVersion(src.getParameter("profile-version").primitiveValue()); - if (src.hasParameter("profile-name")) - tgt.setName(src.getParameter("profile-name").primitiveValue()); - if (src.hasParameter("profile-status")) - tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue())); - - for (Type t : src.getParameters("system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT); - } - for (Type t : src.getParameters("force-system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE); - } - for (Type t : src.getParameters("check-system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK); - } - for (Type t : src.getParameters("exclude-system")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]); - } - if (src.hasParameter("includeDesignations")) - tgt.setIncludeDesignations(src.getParameterBool("")); - for (Type t : src.getParameters("designation")) { - String[] v = t.primitiveValue().split("\\|"); - if ("urn:ietf:bcp:47".equals(v[0])) - tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]); - else - tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]); - } - if (src.hasParameter("includeDefinition")) - tgt.setIncludeDefinition(src.getParameterBool("includeDefinition")); - if (src.hasParameter("activeOnly")) - tgt.setActiveOnly(src.getParameterBool("activeOnly")); - if (src.hasParameter("excludeNested")) - tgt.setExcludeNested(src.getParameterBool("excludeNested")); - if (src.hasParameter("excludeNotForUI")) - tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI")); - if (src.hasParameter("excludeNotForUI")) - tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI")); - if (src.hasParameter("displayLanguage")) - tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue()); - if (src.hasParameter("limitedExpansion")) - tgt.setLimitedExpansion(src.getParameterBool("getParameterBool")); - return tgt; - } - - public static org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiatesCanonical(t.getReference()); - if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - if (src.hasNotDoneReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getNotDoneReason())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRelationship()) - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasGender()) -// tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBorn()) - tgt.setBorn(convertType(src.getBorn())); - if (src.hasAge()) - tgt.setAge(convertType(src.getAge())); - if (src.hasEstimatedAge()) - tgt.setEstimatedAge(src.getEstimatedAge()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesCanonical()) - tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - if (src.hasDataAbsentReason()) - tgt.setNotDoneReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRelationship()) - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasGender()) -// tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBorn()) - tgt.setBorn(convertType(src.getBorn())); - if (src.hasAge()) - tgt.setAge(convertType(src.getAge())); - if (src.hasEstimatedAge()) - tgt.setEstimatedAge(src.getEstimatedAge()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; - } -} - - public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Flag tgt = new org.hl7.fhir.r4.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.r4.model.Flag src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Flag.FlagStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r4.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Goal tgt = new org.hl7.fhir.r4.model.Goal(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setLifecycleStatus(convertGoalStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasStart()) - tgt.setStart(convertType(src.getStart())); - if (src.hasTarget()) - tgt.addTarget(convertGoalTargetComponent(src.getTarget())); - if (src.hasStatusDate()) - tgt.setStatusDateElement(convertDate(src.getStatusDateElement())); - if (src.hasStatusReason()) - tgt.setStatusReason(src.getStatusReason()); - if (src.hasExpressedBy()) - tgt.setExpressedBy(convertReference(src.getExpressedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) - tgt.addOutcomeCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) - tgt.addOutcomeReference(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r4.model.Goal src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasLifecycleStatus()) - tgt.setStatus(convertGoalStatus(src.getLifecycleStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasStart()) - tgt.setStart(convertType(src.getStart())); - if (src.hasTarget()) - tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep())); - if (src.hasStatusDate()) - tgt.setStatusDateElement(convertDate(src.getStatusDateElement())); - if (src.hasStatusReason()) - tgt.setStatusReason(src.getStatusReason()); - if (src.hasExpressedBy()) - tgt.setExpressedBy(convertReference(src.getExpressedBy())); - for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCode()) - tgt.addOutcomeCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) - tgt.addOutcomeReference(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus convertGoalStatus(org.hl7.fhir.dstu3.model.Goal.GoalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PROPOSED; - case ACCEPTED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACCEPTED; - case PLANNED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PLANNED; - case INPROGRESS: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; - case ONTARGET: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; - case AHEADOFTARGET: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; - case BEHINDTARGET: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; - case SUSTAINING: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; - case ACHIEVED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; - case REJECTED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.REJECTED; - default: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Goal.GoalStatus convertGoalStatus(org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PROPOSED; - case ACCEPTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACCEPTED; - case PLANNED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACHIEVED; - case ONHOLD: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ENTEREDINERROR; - case REJECTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.REJECTED; - default: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r4.model.Goal.GoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertType(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r4.model.Goal.GoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertType(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.GraphDefinition tgt = new org.hl7.fhir.r4.model.GraphDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasStart()) - tgt.setStartElement(convertCode(src.getStartElement())); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r4.model.GraphDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasStart()) - tgt.setStartElement(convertCode(src.getStartElement())); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) - tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) - tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) - tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) - tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); - for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCompartmentCode(src.getCode())); - if (src.hasRule()) - tgt.setRule(convertGraphCompartmentRule(src.getRule())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCompartmentCode(src.getCode())); - if (src.hasRule()) - tgt.setRule(convertGraphCompartmentRule(src.getRule())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - private static org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.DEVICE; - default: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE; - default: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL; - } -} - - private static org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IDENTICAL: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; - case MATCHING: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.MATCHING; - case DIFFERENT: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; - case CUSTOM: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.CUSTOM; - default: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IDENTICAL: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; - case MATCHING: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING; - case DIFFERENT: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; - case CUSTOM: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM; - default: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL; - } -} - - public static org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Group tgt = new org.hl7.fhir.r4.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); - if (src.hasActual()) - tgt.setActual(src.getActual()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasQuantity()) - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.r4.model.Group src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); - if (src.hasActual()) - tgt.setActual(src.getActual()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasQuantity()) - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.r4.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.r4.model.Group.GroupType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasExclude()) - tgt.setExclude(src.getExclude()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasExclude()) - tgt.setExclude(src.getExclude()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r4.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - if (src.hasEntity()) - tgt.setEntity(convertReference(src.getEntity())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r4.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - if (src.hasEntity()) - tgt.setEntity(convertReference(src.getEntity())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.HealthcareService tgt = new org.hl7.fhir.r4.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasProvidedBy()) - tgt.setProvidedBy(convertReference(src.getProvidedBy())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasExtraDetails()) - tgt.setExtraDetails(src.getExtraDetails()); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility() || src.hasEligibilityNote()) { - HealthcareServiceEligibilityComponent t = tgt.addEligibility(); - t.setCode(convertCodeableConcept(src.getEligibility())); - if (src.hasEligibilityNote()) - t.setComment(src.getEligibilityNote()); - } - for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) - tgt.addProgram().setText(t.getValue()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); - if (src.hasAppointmentRequired()) - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.r4.model.HealthcareService src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasProvidedBy()) - tgt.setProvidedBy(convertReference(src.getProvidedBy())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasExtraDetails()) - tgt.setExtraDetails(src.getExtraDetails()); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility()) { - tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); - if (src.getEligibilityFirstRep().hasComment()) - tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); - } - for (CodeableConcept t : src.getProgram()) - tgt.addProgramName(t.getText()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); - if (src.hasAppointmentRequired()) - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - private static org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; - } -} - - public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - private static final String URN_DICOM_UID = "urn:dicom:uid"; - - public static org.hl7.fhir.r4.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImagingStudy tgt = new org.hl7.fhir.r4.model.ImagingStudy(); - copyDomainResource(src, tgt); - - if (src.hasUid()) { - org.hl7.fhir.r4.model.Identifier i = new org.hl7.fhir.r4.model.Identifier(); - i.setSystem(URN_DICOM_UID); - i.setValue(src.getUid()); - tgt.addIdentifier(i); - } - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - - if (src.hasAccession()) - tgt.addIdentifier(convertIdentifier(src.getAccession())); - - if (src.hasAvailability()) { - org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability availability = src.getAvailability(); - switch (availability) { - case OFFLINE: - tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.REGISTERED); - break; - case UNAVAILABLE: - tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.CANCELLED); - break; - case ONLINE: - case NEARLINE: - tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.AVAILABLE); - break; - default: - break; - } - } else { - tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.UNKNOWN); - } - - for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) { - tgt.addModality(convertCoding(t)); - } - - if (src.hasPatient()) - tgt.setSubject(convertReference(src.getPatient())); - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasReferrer()) { - tgt.setReferrer(convertReference(src.getReferrer())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) { - tgt.addInterpreter(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasNumberOfSeries()) { - tgt.setNumberOfSeries(src.getNumberOfSeries()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - List procedureReferences = src.getProcedureReference(); - if (procedureReferences.size() > 0) { - tgt.setProcedureReference(convertReference(procedureReferences.get(0))); - - if (procedureReferences.size() > 1) { - // TODO print a warning that only one procedure reference could be converted - } - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProcedureCode()) { - tgt.addProcedureCode(convertCodeableConcept(t)); - } - if (src.hasReason()) { - tgt.addReasonCode(convertCodeableConcept(src.getReason())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { - tgt.addSeries(convertImagingStudySeriesComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r4.model.ImagingStudy src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { - - // assuming that there is only one urn:dicom:uid identifier - if (URN_DICOM_UID.equals(t.getSystem())) { - tgt.setUid(t.getValue()); - } else { - tgt.addIdentifier(convertIdentifier(t)); - } - } - if (src.hasStatus()) { - org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus s = src.getStatus(); - switch (s) { - case REGISTERED: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE); - break; - case AVAILABLE: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE); - break; - case CANCELLED: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); - break; - default: - break; - } - } - for (org.hl7.fhir.r4.model.Coding t : src.getModality()) { - tgt.addModalityList(convertCoding(t)); - } - if (src.hasSubject()) { - tgt.setPatient(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasReferrer()) { - tgt.setReferrer(convertReference(src.getReferrer())); - } - for (org.hl7.fhir.r4.model.Reference t : src.getInterpreter()) { - tgt.addInterpreter(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasNumberOfSeries()) { - tgt.setNumberOfSeries(src.getNumberOfSeries()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - if (src.hasProcedureReference()) { - tgt.addProcedureReference(convertReference(src.getProcedureReference())); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProcedureCode()) { - tgt.addProcedureCode(convertCodeableConcept(t)); - } - // location was added in R4 and does not exist in DSTU3 - List reasonCodes = src.getReasonCode(); - if (reasonCodes.size() > 0) { - tgt.setReason(convertCodeableConcept(reasonCodes.get(0))); - - if (reasonCodes.size() > 1) { - // TODO print a warning that only one reason could be converted - } - } - // reasonReference was added in R4 and does not exist in DSTU3 - // node was added in R4 and does not exist in DSTU3 - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { - tgt.addSeries(convertImagingStudySeriesComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasModality()) { - tgt.setModality(convertCoding(src.getModality())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCoding(src.getBodySite())); - } - if (src.hasLaterality()) { - tgt.setLaterality(convertCoding(src.getLaterality())); - } - // the specimen element was added in R4 and does not exist in DSTU3 - if (src.hasStarted()) { - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasModality()) { - tgt.setModality(convertCoding(src.getModality())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCoding(src.getBodySite())); - } - if (src.hasLaterality()) { - tgt.setLaterality(convertCoding(src.getLaterality())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - // the specimen element was added in R4 and does not exist in DSTU3 - - for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - } - - return tgt; - } - - private static final String URN_IETF_RFC_3986 = "urn:ietf:rfc:3986"; - - private static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasSopClass()) { - org.hl7.fhir.r4.model.Coding c = new org.hl7.fhir.r4.model.Coding(); - c.setSystem(URN_IETF_RFC_3986); - c.setCode(src.getSopClass()); - tgt.setSopClass(c); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - org.hl7.fhir.r4.model.Coding sop = src.getSopClass(); - if (URN_IETF_RFC_3986.equals(sop.getSystem())) { - tgt.setSopClass(sop.getCode()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - - return tgt; - } - - public static org.hl7.fhir.r4.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Immunization tgt = new org.hl7.fhir.r4.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertImmunizationStatus(src.getStatus())); - if (src.hasVaccineCode()) - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDateElement()) - tgt.setOccurrence(convertDateTime(src.getDateElement())); - if (src.hasPrimarySource()) - tgt.setPrimarySource(src.getPrimarySource()); - if (src.hasReportOrigin()) - tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDateElement(convertDate(src.getExpirationDateElement())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasDoseQuantity()) - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent t : src.getPractitioner()) - tgt.addPerformer(convertImmunizationPractitionerComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReasonNotGiven()) -// tgt.addReason(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r4.model.Immunization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertImmunizationStatus(src.getStatus())); - if (src.hasVaccineCode()) - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasOccurrenceDateTimeType()) - tgt.setDateElement(convertDateTime(src.getOccurrenceDateTimeType())); - if (src.hasPrimarySource()) - tgt.setPrimarySource(src.getPrimarySource()); - if (src.hasReportOrigin()) - tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDateElement(convertDate(src.getExpirationDateElement())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasDoseQuantity()) - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) - tgt.addPractitioner(convertImmunizationPractitionerComponent(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.getExplanation().addReason(convertCodeableConcept(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r4.model.Immunization.ImmunizationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setFunction(convertCodeableConcept(src.getRole())); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent(); - copyElement(src, tgt); - if (src.hasFunction()) - tgt.setRole(convertCodeableConcept(src.getFunction())); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - return tgt; - } - - - - public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - if (src.hasPage()) - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - break; - } - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) { - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - } - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r4.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - if (src.getDefinition().hasPage()) - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (t.getId().equals(id)) - return t; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t1.setName("Default Package"); - t1.setId(id); - return t1; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } - - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) { - org.hl7.fhir.r4.model.Type t = convertType(src.getExampleFor()); - tgt.setExample(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); - } else if (src.hasExample()) - tgt.setExample(new org.hl7.fhir.r4.model.BooleanType(src.getExample())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) { - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - tgt.setExample(true); - } else if (src.hasExampleBooleanType()) - tgt.setExample(src.getExampleBooleanType().getValue()); - else - tgt.setExample(false); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setName(convertUriToUrl(src.getSourceElement())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration convertPageGeneration(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind kind) { - switch (kind) { - case PAGE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.HTML; - default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.GENERATED; - } - } - - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertPageGeneration(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration generation) { - switch (generation) { - case HTML: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - } - } - - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - - public static org.hl7.fhir.r4.model.Linkage convertLinkage(org.hl7.fhir.dstu3.model.Linkage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Linkage tgt = new org.hl7.fhir.r4.model.Linkage(); - copyDomainResource(src, tgt); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent t : src.getItem()) - tgt.addItem(convertLinkageItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Linkage convertLinkage(org.hl7.fhir.r4.model.Linkage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Linkage tgt = new org.hl7.fhir.dstu3.model.Linkage(); - copyDomainResource(src, tgt); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r4.model.Linkage.LinkageItemComponent t : src.getItem()) - tgt.addItem(convertLinkageItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r4.model.Linkage.LinkageItemComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertLinkageType(src.getType())); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r4.model.Linkage.LinkageItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertLinkageType(src.getType())); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.dstu3.model.Linkage.LinkageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r4.model.Linkage.LinkageType.SOURCE; - case ALTERNATE: return org.hl7.fhir.r4.model.Linkage.LinkageType.ALTERNATE; - case HISTORICAL: return org.hl7.fhir.r4.model.Linkage.LinkageType.HISTORICAL; - default: return org.hl7.fhir.r4.model.Linkage.LinkageType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r4.model.Linkage.LinkageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.SOURCE; - case ALTERNATE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.ALTERNATE; - case HISTORICAL: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.HISTORICAL; - default: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.NULL; - } -} - - public static org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntryComponent(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntryComponent(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - return tgt; - } - - private static org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); - copyElement(src, tgt); - if (src.hasFlag()) - tgt.setFlag(convertCodeableConcept(src.getFlag())); - if (src.hasDeleted()) - tgt.setDeleted(src.getDeleted()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasItem()) - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); - copyElement(src, tgt); - if (src.hasFlag()) - tgt.setFlag(convertCodeableConcept(src.getFlag())); - if (src.hasDeleted()) - tgt.setDeleted(src.getDeleted()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasItem()) - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Location tgt = new org.hl7.fhir.r4.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); - if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); - if (src.hasType()) - tgt.addType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasPhysicalType()) - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - if (src.hasPosition()) - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.r4.model.Location src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); - if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasPhysicalType()) - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - if (src.hasPosition()) - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.r4.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.r4.model.Location.LocationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r4.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r4.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - if (src.hasLongitude()) - tgt.setLongitude(src.getLongitude()); - if (src.hasLatitude()) - tgt.setLatitude(src.getLatitude()); - if (src.hasAltitude()) - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r4.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - if (src.hasLongitude()) - tgt.setLongitude(src.getLongitude()); - if (src.hasLatitude()) - tgt.setLatitude(src.getLatitude()); - if (src.hasAltitude()) - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - private static final String CODE_SYSTEM_MEDIA_TYPE = "http://terminology.hl7.org/CodeSystem/media-type"; - - public static org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Media tgt = new org.hl7.fhir.r4.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasType()) { - org.hl7.fhir.r4.model.Coding coding = new org.hl7.fhir.r4.model.Coding(); - coding.setSystem(CODE_SYSTEM_MEDIA_TYPE); - coding.setCode(src.getType().toCode().replace("photo", "image")); - CodeableConcept codeableConcept = new CodeableConcept(coding); - tgt.setType(codeableConcept); - } - if (src.hasSubtype()) { - tgt.setModality(convertCodeableConcept(src.getSubtype())); - } - if (src.hasView()) { - tgt.setView(convertCodeableConcept(src.getView())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasOccurrence()) { - tgt.setCreated(convertType(src.getOccurrence())); - } - if (src.hasOperator()) { - tgt.setOperator(convertReference(src.getOperator())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - } - if (src.hasDevice()) { - tgt.setDevice(convertReference(src.getDevice())); - } - if (src.hasHeight()) { - tgt.setHeight(src.getHeight()); - } - if (src.hasWidth()) { - tgt.setWidth(src.getWidth()); - } - if (src.hasFrames()) { - tgt.setFrames(src.getFrames()); - } - if (src.hasDuration()) { - tgt.setDuration(src.getDuration()); - } - if (src.hasContent()) { - tgt.setContent(convertAttachment(src.getContent())); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - tgt.setStatus(org.hl7.fhir.r4.model.Media.MediaStatus.COMPLETED); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.r4.model.Media src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasType()) { - CodeableConcept type = src.getType(); - for (org.hl7.fhir.r4.model.Coding c : type.getCoding()) { - if (CODE_SYSTEM_MEDIA_TYPE.equals(c.getSystem())) { - tgt.setType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.fromCode(c.getCode().replace("image", "photo"))); - break; - } - } - } - if (src.hasModality()) { - tgt.setSubtype(convertCodeableConcept(src.getModality())); - } - if (src.hasView()) { - tgt.setView(convertCodeableConcept(src.getView())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasCreated()) { - tgt.setOccurrence(convertType(src.getCreated())); - } - if (src.hasOperator()) { - tgt.setOperator(convertReference(src.getOperator())); - } - for (CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - } - if (src.hasDevice()) { - tgt.setDevice(convertReference(src.getDevice())); - } - if (src.hasHeight()) { - tgt.setHeight(src.getHeight()); - } - if (src.hasWidth()) { - tgt.setWidth(src.getWidth()); - } - if (src.hasFrames()) { - tgt.setFrames(src.getFrames()); - } - if (src.hasDuration()) { - tgt.setDuration(src.getDuration().intValue()); - } - if (src.hasContent()) { - tgt.setContent(convertAttachment(src.getContent())); - } - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Medication tgt = new org.hl7.fhir.r4.model.Medication(); - copyDomainResource(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatus(src.getStatus())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasForm()) - tgt.setForm(convertCodeableConcept(src.getForm())); - for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertMedicationIngredientComponent(t)); - if (src.hasPackage()) - tgt.setBatch(convertMedicationPackageBatchComponent(src.getPackage().getBatchFirstRep())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.r4.model.Medication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); - copyDomainResource(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatus(src.getStatus())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasForm()) - tgt.setForm(convertCodeableConcept(src.getForm())); - for (org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertMedicationIngredientComponent(t)); - if (src.hasBatch()) - tgt.getPackage().addBatch(convertMedicationPackageBatchComponent(src.getBatch())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.dstu3.model.Medication.MedicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Medication.MedicationStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r4.model.Medication.MedicationStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Medication.MedicationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Medication.MedicationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r4.model.Medication.MedicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent(); - copyElement(src, tgt); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - if (src.hasIsActive()) - tgt.setIsActive(src.getIsActive()); - if (src.hasAmount()) - tgt.setStrength(convertRatio(src.getAmount())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent(); - copyElement(src, tgt); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - if (src.hasIsActive()) - tgt.setIsActive(src.getIsActive()); - if (src.hasStrength()) - tgt.setAmount(convertRatio(src.getStrength())); - return tgt; - } - - - public static org.hl7.fhir.r4.model.Medication.MedicationBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationBatchComponent(); - copyElement(src, tgt); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.r4.model.Medication.MedicationBatchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent(); - copyElement(src, tgt); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.dstu3.model.MedicationAdministration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationAdministration tgt = new org.hl7.fhir.r4.model.MedicationAdministration(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiates(t.getReference()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - for (org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); -// if (src.hasNotGiven()) -// tgt.setNotGiven(src.getNotGiven()); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) -// tgt.addReasonNotGiven(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - if (src.hasPrescription()) - tgt.setRequest(convertReference(src.getPrescription())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDevice()) - tgt.addDevice(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - if (src.hasDosage()) - tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r4.model.MedicationAdministration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) - tgt.addDefinition().setReference(t.getValue()); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - for (org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); -// if (src.hasNotGiven()) -// tgt.setNotGiven(src.getNotGiven()); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotGiven()) -// tgt.addReasonNotGiven(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - if (src.hasRequest()) - tgt.setPrescription(convertReference(src.getRequest())); - for (org.hl7.fhir.r4.model.Reference t : src.getDevice()) - tgt.addDevice(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - if (src.hasDosage()) - tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); - for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static String convertMedicationAdministrationStatus(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus src) throws FHIRException { - if (src == null) - return null; - return src.toCode(); - } - - private static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus convertMedicationAdministrationStatus(String src) throws FHIRException { - if (src == null) - return null; - return org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus.fromCode(src); - } - - public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent(); - copyElement(src, tgt); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertSimpleQuantity(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent(); - copyElement(src, tgt); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertSimpleQuantity(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - for (org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasDaysSupply()) - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - if (src.hasWhenPrepared()) - tgt.setWhenPreparedElement(convertDateTime(src.getWhenPreparedElement())); - if (src.hasWhenHandedOver()) - tgt.setWhenHandedOverElement(convertDateTime(src.getWhenHandedOverElement())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); -// if (src.hasNotDone()) -// tgt.setNotDone(src.getNotDone()); -// if (src.hasNotDoneReason()) -// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - for (org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasDaysSupply()) - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - if (src.hasWhenPrepared()) - tgt.setWhenPreparedElement(convertDateTime(src.getWhenPreparedElement())); - if (src.hasWhenHandedOver()) - tgt.setWhenHandedOverElement(convertDateTime(src.getWhenHandedOverElement())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); -// if (src.hasNotDone()) -// tgt.setNotDone(src.getNotDone()); -// if (src.hasNotDoneReason()) -// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); - for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static String convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - return src.toCode(); -} - - private static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { - if (src == null) - return null; - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); - } - - public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasWasSubstituted()) - tgt.setWasSubstituted(src.getWasSubstituted()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasWasSubstituted()) - tgt.setWasSubstituted(src.getWasSubstituted()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationRequest tgt = new org.hl7.fhir.r4.model.MedicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) -// tgt.addDefinition(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasGroupIdentifier()) - tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); - if (src.hasIntent()) - tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasPriority()) - tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasAuthoredOn()) - tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasDispenseRequest()) - tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); - if (src.hasPriorPrescription()) - tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r4.model.MedicationRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getDefinition()) -// tgt.addDefinition(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasGroupIdentifier()) - tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); - if (src.hasIntent()) - tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasPriority()) - tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasAuthoredOn()) - tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasDispenseRequest()) - tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); - if (src.hasPriorPrescription()) - tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); - for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.STOPPED; - case DRAFT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.DRAFT; - case UNKNOWN: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED; - case DRAFT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT; - case UNKNOWN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSAL: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; - case PLAN: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PLAN; - case ORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER; - case INSTANCEORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; - default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSAL: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; - case PLAN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN; - case ORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER; - case INSTANCEORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL; - } -} - - private static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.URGENT; - case STAT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.STAT; - case ASAP: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ASAP; - default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT; - case STAT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT; - case ASAP: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL; - } -} -// -// public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestRequesterComponent(); -// copyElement(src, tgt); -// if (src.hasAgent()) -// tgt.setAgent(convertReference(src.getAgent())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent(); -// copyElement(src, tgt); -// if (src.hasAgent()) -// tgt.setAgent(convertReference(src.getAgent())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); -// return tgt; -// } - - public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); - copyElement(src, tgt); - if (src.hasValidityPeriod()) - tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); - if (src.hasNumberOfRepeatsAllowed()) - tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasExpectedSupplyDuration()) - tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); - copyElement(src, tgt); - if (src.hasValidityPeriod()) - tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); - if (src.hasNumberOfRepeatsAllowed()) - tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasExpectedSupplyDuration()) - tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasAllowed()) - tgt.setAllowed(convertBoolean(src.getAllowedElement())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasAllowedBooleanType()) - tgt.setAllowedElement(convertBoolean(src.getAllowedBooleanType())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateAsserted()) - tgt.setDateAssertedElement(convertDateTime(src.getDateAssertedElement())); - if (src.hasInformationSource()) - tgt.setInformationSource(convertReference(src.getInformationSource())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) - tgt.addDerivedFrom(convertReference(t)); -// if (src.hasTaken()) -// tgt.addExtension(convertMedicationStatementTaken(src.getTaken())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasContext()) - tgt.setContext(convertReference(src.getContext())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateAsserted()) - tgt.setDateAssertedElement(convertDateTime(src.getDateAssertedElement())); - if (src.hasInformationSource()) - tgt.setInformationSource(convertReference(src.getInformationSource())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) - tgt.addDerivedFrom(convertReference(t)); -// if (src.hasExtension(VersionConvertorConstants.MODIFIER_TAKEN)) -// tgt.setTaken(convertMedicationStatementTaken(src.getExtensionByUrl(VersionConvertorConstants.MODIFIER_TAKEN))); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD; - default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD; - default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; - } -} -// -// private static org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case Y: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken.Y; -// case N: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken.N; -// case UNK: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken.UNK; -// case NA: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken.NA; -// default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementTaken src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case Y: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.Y; -// case N: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.N; -// case UNK: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.UNK; -// case NA: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NA; -// default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NULL; -// } -//} - - public static org.hl7.fhir.r4.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.dstu3.model.MessageDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageDefinition tgt = new org.hl7.fhir.r4.model.MessageDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasBase()) - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.getParent().add(convertReferenceToCanonical(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) - tgt.getReplaces().add(convertReferenceToCanonical(t)); - if (src.hasEvent()) - tgt.setEvent(convertCoding(src.getEvent())); - if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) - tgt.addFocus(convertMessageDefinitionFocusComponent(t)); - if (src.hasResponseRequired()) - tgt.setResponseRequired(src.getResponseRequired() ? org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS : org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NEVER); - for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) - tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); - return tgt; - } - - public static String convertCoding2Uri(org.hl7.fhir.dstu3.model.Coding code) { - return code.getSystem()+"/"+code.getCode(); - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r4.model.MessageDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition tgt = new org.hl7.fhir.dstu3.model.MessageDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - for (org.hl7.fhir.r4.model.CanonicalType t : src.getParent()) - tgt.addParent(convertCanonicalToReference(t)); - for (org.hl7.fhir.r4.model.CanonicalType t : src.getReplaces()) - tgt.addReplaces(convertCanonicalToReference(t)); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) - tgt.addFocus(convertMessageDefinitionFocusComponent(t)); - if (src.hasResponseRequired()) - tgt.setResponseRequired(src.getResponseRequired() != org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NEVER); - for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) - tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertUri2Coding(String uri) { - int i = uri.lastIndexOf("/"); - return new org.hl7.fhir.dstu3.model.Coding().setSystem(uri.substring(0, i)).setCode(uri.substring(i+1)); - } - - private static org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NULL; - } -} - - public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); - copyElement(src, tgt); - if (src.hasMessage()) - tgt.setMessageElement(convertReferenceToCanonical(src.getMessage())); - if (src.hasSituation()) - tgt.setSituation(src.getSituation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); - copyElement(src, tgt); - if (src.hasMessage()) - tgt.setMessage(convertCanonicalToReference(src.getMessageElement())); - if (src.hasSituation()) - tgt.setSituation(src.getSituation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); - copyDomainResource(src, tgt); - if (src.hasEvent()) - tgt.setEvent(convertCoding(src.getEvent())); - for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); -// if (src.hasTimestamp()) -// tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); - if (src.hasEnterer()) - tgt.setEnterer(convertReference(src.getEnterer())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertMessageSourceComponent(src.getSource())); - if (src.hasResponsible()) - tgt.setResponsible(convertReference(src.getResponsible())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - if (src.hasResponse()) - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); - copyDomainResource(src, tgt); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); -// if (src.hasTimestamp()) -// tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); - if (src.hasEnterer()) - tgt.setEnterer(convertReference(src.getEnterer())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertMessageSourceComponent(src.getSource())); - if (src.hasResponsible()) - tgt.setResponsible(convertReference(src.getResponsible())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - if (src.hasResponse()) - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSoftware()) - tgt.setSoftware(src.getSoftware()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasContact()) - tgt.setContact(convertContactPoint(src.getContact())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSoftware()) - tgt.setSoftware(src.getSoftware()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasContact()) - tgt.setContact(convertContactPoint(src.getContact())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - private static org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; - } -} - - public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); - copyDomainResource(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } -} - - public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } -} - -// public static org.hl7.fhir.r4.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.dstu3.model.NutritionOrder src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder tgt = new org.hl7.fhir.r4.model.NutritionOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateTime()) -// tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); -// if (src.hasOrderer()) -// tgt.setOrderer(convertReference(src.getOrderer())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAllergyIntolerance()) -// tgt.addAllergyIntolerance(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFoodPreferenceModifier()) -// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExcludeFoodModifier()) -// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); -// if (src.hasOralDiet()) -// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) -// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); -// if (src.hasEnteralFormula()) -// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.r4.model.NutritionOrder src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder tgt = new org.hl7.fhir.dstu3.model.NutritionOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateTime()) -// tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); -// if (src.hasOrderer()) -// tgt.setOrderer(convertReference(src.getOrderer())); -// for (org.hl7.fhir.r4.model.Reference t : src.getAllergyIntolerance()) -// tgt.addAllergyIntolerance(convertReference(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFoodPreferenceModifier()) -// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getExcludeFoodModifier()) -// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); -// if (src.hasOralDiet()) -// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); -// for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) -// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); -// if (src.hasEnteralFormula()) -// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.CANCELLED; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.CANCELLED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) -// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) -// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFluidConsistencyType()) -// tgt.addFluidConsistencyType(convertCodeableConcept(t)); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// for (org.hl7.fhir.r4.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) -// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); -// for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) -// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFluidConsistencyType()) -// tgt.addFluidConsistencyType(convertCodeableConcept(t)); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasAmount()) -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasAmount()) -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasFoodType()) -// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasFoodType()) -// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasProductName()) -// tgt.setProductName(src.getProductName()); -// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasProductName()) -// tgt.setProductName(src.getProductName()); -// for (org.hl7.fhir.r4.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); -// copyElement(src, tgt); -// if (src.hasBaseFormulaType()) -// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); -// if (src.hasBaseFormulaProductName()) -// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); -// if (src.hasAdditiveType()) -// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); -// if (src.hasAdditiveProductName()) -// tgt.setAdditiveProductName(src.getAdditiveProductName()); -// if (src.hasCaloricDensity()) -// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); -// if (src.hasRouteofAdministration()) -// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) -// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); -// if (src.hasMaxVolumeToDeliver()) -// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); -// if (src.hasAdministrationInstruction()) -// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); -// copyElement(src, tgt); -// if (src.hasBaseFormulaType()) -// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); -// if (src.hasBaseFormulaProductName()) -// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); -// if (src.hasAdditiveType()) -// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); -// if (src.hasAdditiveProductName()) -// tgt.setAdditiveProductName(src.getAdditiveProductName()); -// if (src.hasCaloricDensity()) -// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); -// if (src.hasRouteofAdministration()) -// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); -// for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) -// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); -// if (src.hasMaxVolumeToDeliver()) -// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); -// if (src.hasAdministrationInstruction()) -// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); -// copyElement(src, tgt); -// if (src.hasSchedule()) -// tgt.setSchedule(convertTiming(src.getSchedule())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasRate()) -// tgt.setRate(convertType(src.getRate())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); -// copyElement(src, tgt); -// if (src.hasSchedule()) -// tgt.setSchedule(convertTiming(src.getSchedule())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasRate()) -// tgt.setRate(convertType(src.getRate())); -// return tgt; -// } - - public static org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssuedElement(convertInstant(src.getIssuedElement())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - if (src.hasComment()) - tgt.addNote().setText(src.getComment()); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) - if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER) - tgt.addHasMember(convertReference(t.getTarget())); - else if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM) - tgt.addDerivedFrom(convertReference(t.getTarget())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssuedElement(convertInstant(src.getIssuedElement())); - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - if (src.hasNote()) - tgt.setComment(src.getNoteFirstRep().getText()); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getHasMember()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER)); - for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM)); - for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAppliesTo()) - tgt.addAppliesTo(convertCodeableConcept(t)); - if (src.hasAge()) - tgt.setAge(convertRange(src.getAge())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) - tgt.addAppliesTo(convertCodeableConcept(t)); - if (src.hasAge()) - tgt.setAge(convertRange(src.getAge())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Reference src, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType type) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(type); - tgt.setTarget(convertReference(src)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasBase()) - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addResource(t.getValue()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasInstance()) - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) - tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasAffectsState()) - tgt.setIdempotent(!src.getAffectsState()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) - tgt.addResource(t.getValue()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasInstance()) - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) - tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } -} - - public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasSearchType()) - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - if (src.hasProfile()) - tgt.addTargetProfile(src.getProfile().getReference()); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasSearchType()) - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - for (org.hl7.fhir.r4.model.UriType t : src.getTargetProfile()) - tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } -} - - public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - Type t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r4.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParameterName()) - tgt.addParameterName(t.getValue()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.StringType t : src.getParameterName()) - tgt.addParameterName(t.getValue()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } -} - - private static org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - if (src.hasPurpose()) - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - if (src.hasPurpose()) - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Patient tgt = new org.hl7.fhir.r4.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasMaritalStatus()) - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - if (src.hasMultipleBirth()) - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasAnimal()) - tgt.addExtension(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) - tgt.addGeneralPractitioner(convertReference(t)); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.r4.model.Patient src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasMaritalStatus()) - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - if (src.hasMultipleBirth()) - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r4.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) - tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); - for (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getGeneralPractitioner()) - tgt.addGeneralPractitioner(convertReference(t)); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r4.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Extension convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); - copyElement(src, tgt); - if (src.hasSpecies()) - tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); - if (src.hasBreed()) - tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); - if (src.hasGenderStatus()) - tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); - copyElement(src, tgt); - if (src.hasExtension("species")) - tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); - if (src.hasExtension("breed")) - tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); - if (src.hasExtension("genderStatus")) - tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - if (src.hasOther()) - tgt.setOther(convertReference(src.getOther())); - if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r4.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - if (src.hasOther()) - tgt.setOther(convertReference(src.getOther())); - if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; - case REPLACES: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACES; - case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; - case REPLACES: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACES; - case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; - } -} - - public static org.hl7.fhir.r4.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PaymentNotice tgt = new org.hl7.fhir.r4.model.PaymentNotice(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); - if (src.hasRequest()) - tgt.setRequest(convertReference(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasStatusDate()) - tgt.setPaymentDateElement(convertDate(src.getStatusDateElement())); - if (src.hasCreated()) - tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); - if (src.hasTarget()) - tgt.setRecipient(convertReference(src.getTarget())); - if (src.hasProvider()) - tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasOrganization()) -// tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPaymentStatus()) - tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r4.model.PaymentNotice src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); - if (src.hasRequest()) - tgt.setRequest(convertReference(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasPaymentDate()) - tgt.setStatusDateElement(convertDate(src.getPaymentDateElement())); - if (src.hasCreated()) - tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); - if (src.hasRecipient()) - tgt.setTarget(convertReference(src.getRecipient())); - if (src.hasProvider()) - tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasOrganization()) -// tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPaymentStatus()) - tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); - return tgt; - } - - private static org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; - case DRAFT: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.DRAFT; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; - case DRAFT: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL; - } -} - - - public static org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Person tgt = new org.hl7.fhir.r4.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.r4.model.Person src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r4.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r4.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; - } -} - - public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); - for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIssuer()) - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIssuer()) - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public static org.hl7.fhir.r4.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PractitionerRole tgt = new org.hl7.fhir.r4.model.PractitionerRole(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasPractitioner()) - tgt.setPractitioner(convertReference(src.getPractitioner())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) - tgt.addHealthcareService(convertReference(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r4.model.PractitionerRole src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole tgt = new org.hl7.fhir.dstu3.model.PractitionerRole(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasPractitioner()) - tgt.setPractitioner(convertReference(src.getPractitioner())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) - tgt.addHealthcareService(convertReference(t)); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); - for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - private static org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SUN; - default: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.NULL; - } -} - - public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Procedure tgt = new org.hl7.fhir.r4.model.Procedure(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.getNotDone()) { - tgt.setStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NOTDONE); - } else { - tgt.setStatus(convertProcedureStatus(src.getStatus())); - } - if (src.hasNotDoneReason()) { - tgt.setStatusReason(convertCodeableConcept(src.getNotDoneReason())); - } - if (src.hasCategory()) { - tgt.setCategory(convertCodeableConcept(src.getCategory())); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasPerformed()) { - tgt.setPerformed(convertType(src.getPerformed())); - } - for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) { - tgt.addPerformer(convertProcedurePerformerComponent(t)); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) { - tgt.addBodySite(convertCodeableConcept(t)); - } - if (src.hasOutcome()) { - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) { - tgt.addReport(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) { - tgt.addComplication(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getComplicationDetail()) { - tgt.addComplicationDetail(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) { - tgt.addFollowUp(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) { - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getUsedReference()) { - tgt.addUsedReference(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getUsedCode()) { - tgt.addUsedCode(convertCodeableConcept(t)); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.r4.model.Procedure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.hasStatus()) { - org.hl7.fhir.r4.model.Procedure.ProcedureStatus status = src.getStatus(); - if (org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NOTDONE.equals(status)) { - tgt.setStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.SUSPENDED); - tgt.setNotDone(true); - tgt.setNotDoneReason(convertCodeableConcept(src.getStatusReason())); - } else { - tgt.setStatus(convertProcedureStatus(src.getStatus())); - tgt.setNotDone(false); - } - } - if (src.hasCategory()) { - tgt.setCategory(convertCodeableConcept(src.getCategory())); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasPerformed()) { - tgt.setPerformed(convertType(src.getPerformed())); - } - for (org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) { - tgt.addPerformer(convertProcedurePerformerComponent(t)); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) { - tgt.addBodySite(convertCodeableConcept(t)); - } - if (src.hasOutcome()) { - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReport()) { - tgt.addReport(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getComplication()) { - tgt.addComplication(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getComplicationDetail()) { - tgt.addComplicationDetail(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFollowUp()) { - tgt.addFollowUp(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - for (org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) { - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getUsedReference()) { - tgt.addUsedReference(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getUsedCode()) { - tgt.addUsedCode(convertCodeableConcept(t)); - } - - return tgt; - } - - private static org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.PREPARATION; - case INPROGRESS: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS; - case SUSPENDED: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ONHOLD; - case ABORTED: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.STOPPED; - case COMPLETED: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR; - case UNKNOWN: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.UNKNOWN; - default: - return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.PREPARATION; - case INPROGRESS: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; - case ONHOLD: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.SUSPENDED; - case STOPPED: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; - } - } - - private static org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - - if (src.hasRole()) { - tgt.setFunction(convertCodeableConcept(src.getRole())); - } - if (src.hasActor()) { - tgt.setActor(convertReference(src.getActor())); - } - if (src.hasOnBehalfOf()) { - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - - if (src.hasFunction()) { - tgt.setRole(convertCodeableConcept(src.getFunction())); - } - if (src.hasActor()) { - tgt.setActor(convertReference(src.getActor())); - } - if (src.hasOnBehalfOf()) { - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - } - - return tgt; - } - - private static org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - - if (src.hasAction()) { - tgt.setAction(convertCodeableConcept(src.getAction())); - } - if (src.hasManipulated()) { - tgt.setManipulated(convertReference(src.getManipulated())); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - - if (src.hasAction()) { - tgt.setAction(convertCodeableConcept(src.getAction())); - } - if (src.hasManipulated()) { - tgt.setManipulated(convertReference(src.getManipulated())); - } - - return tgt; - } - - private static org.hl7.fhir.r4.model.ServiceRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ServiceRequest tgt = new org.hl7.fhir.r4.model.ServiceRequest(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - if (src.hasRequisition()) { - tgt.setRequisition(convertIdentifier(src.getRequisition())); - } - if (src.hasStatus()) { - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertProcedureRequestIntent(src.getIntent())); - } - if (src.hasPriority()) { - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - } - if (src.hasDoNotPerform()) { - tgt.setDoNotPerform(src.getDoNotPerform()); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasOccurrence()) { - tgt.setOccurrence(convertType(src.getOccurrence())); - } - if (src.hasAsNeeded()) { - tgt.setAsNeeded(convertType(src.getAsNeeded())); - } - if (src.hasAuthoredOn()) { - tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); - } - if (src.hasRequester()) { - org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestRequesterComponent requester = src.getRequester(); - if (requester.hasAgent()) { - tgt.setRequester(convertReference(requester.getAgent())); - } - } - if (src.hasPerformerType()) { - tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); - } - if (src.hasPerformer()) { - tgt.addPerformer(convertReference(src.getPerformer())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) { - tgt.addSpecimen(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) { - tgt.addBodySite(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getRelevantHistory()) { - tgt.addRelevantHistory(convertReference(t)); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.r4.model.ServiceRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - if (src.hasRequisition()) { - tgt.setRequisition(convertIdentifier(src.getRequisition())); - } - if (src.hasStatus()) { - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertProcedureRequestIntent(src.getIntent())); - } - if (src.hasPriority()) { - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - } - if (src.hasDoNotPerform()) { - tgt.setDoNotPerform(src.getDoNotPerform()); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasOccurrence()) { - tgt.setOccurrence(convertType(src.getOccurrence())); - } - if (src.hasAsNeeded()) { - tgt.setAsNeeded(convertType(src.getAsNeeded())); - } - if (src.hasAuthoredOn()) { - - tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); - } - if (src.hasRequester()) { - tgt.setRequester(new org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestRequesterComponent(convertReference(src.getRequester()))); - } - if (src.hasPerformerType()) { - tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); - } - List performers = src.getPerformer(); - if (performers.size() > 0) { - tgt.setPerformer(convertReference(performers.get(0))); - if (performers.size() > 1) { - // TODO print a warning that only one performer could be converted - } - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReasonCode(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { - tgt.addReasonReference(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) { - tgt.addSpecimen(convertReference(t)); - } - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) { - tgt.addBodySite(convertCodeableConcept(t)); - } - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) { - tgt.addRelevantHistory(convertReference(t)); - } - - return tgt; - } - - private static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) - return null; - - switch (src) { - case ACTIVE: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ACTIVE; - case CANCELLED: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.REVOKED; - case COMPLETED: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ENTEREDINERROR; - case SUSPENDED: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ONHOLD; - case UNKNOWN: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.UNKNOWN; - default: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus src) throws FHIRException { - if (src == null) - return null; - - switch (src) { - case ACTIVE: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case COMPLETED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; - case ONHOLD: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; - case REVOKED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.CANCELLED; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; - } - } - - private static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent convertProcedureRequestIntent(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent src) { - if (src == null) - return null; - - switch (src) { - case FILLERORDER: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.FILLERORDER; - case INSTANCEORDER: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.INSTANCEORDER; - case OPTION: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.OPTION; - case ORDER: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORDER; - case ORIGINALORDER: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORIGINALORDER; - case PLAN: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PROPOSAL; - case REFLEXORDER: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.REFLEXORDER; - default: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent convertProcedureRequestIntent(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent src) { - if (src == null) - return null; - - switch (src) { - case DIRECTIVE: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.NULL; - case FILLERORDER: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.FILLERORDER; - case INSTANCEORDER: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.INSTANCEORDER; - case OPTION: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.OPTION; - case ORDER: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.ORDER; - case ORIGINALORDER: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.ORIGINALORDER; - case PLAN: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.PROPOSAL; - case REFLEXORDER: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.REFLEXORDER; - default: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.NULL; - } - } - - private static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) { - if (src == null) - return null; - - switch (src) { - case ASAP: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ASAP; - case ROUTINE: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ROUTINE; - case STAT: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.STAT; - case URGENT: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.URGENT; - default: - return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority src) { - if (src == null) - return null; - - switch (src) { - case ASAP: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - case ROUTINE: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case STAT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case URGENT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - default: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - public static org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Provenance tgt = new org.hl7.fhir.r4.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - if (src.hasPeriod()) - tgt.setOccurred(convertPeriod(src.getPeriod())); - if (src.hasRecorded()) - tgt.setRecordedElement(convertInstant(src.getRecordedElement())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) - tgt.addReason(convertCodingToCodeableConcept(t)); - if (src.hasActivity()) - tgt.setActivity(convertCodingToCodeableConcept(src.getActivity())); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.r4.model.Provenance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - if (src.hasOccurredPeriod()) - tgt.setPeriod(convertPeriod(src.getOccurredPeriod())); - if (src.hasRecorded()) - tgt.setRecordedElement(convertInstant(src.getRecordedElement())); - for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) - for (org.hl7.fhir.r4.model.Coding tc : t.getCoding()) - tgt.addReason(convertCoding(tc)); - if (src.hasActivity()) - tgt.setActivity(convertCoding(src.getActivity())); - for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - Type t = convertType(src.getWho()); - if (t instanceof Reference) - tgt.setWho((Reference) t); - if (t instanceof UriType) - tgt.getWho().setReference(t.primitiveValue()); - } - if (src.hasOnBehalfOf()) { - Type t = convertType(src.getOnBehalfOf()); - if (t instanceof Reference) - tgt.setOnBehalfOf((Reference) t); - if (t instanceof UriType) - tgt.getOnBehalfOf().setReference(t.primitiveValue()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhat()) { - Type t = convertType(src.getWhat()); - if (t instanceof Reference) - tgt.setWhat((Reference) t); - else if (t instanceof Identifier) - tgt.getWhat().setIdentifier((Identifier) t); - else if (t instanceof UriType) - tgt.getWhat().setReference(t.primitiveValue()); - } - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhat()) - tgt.setWhat(convertType(src.getWhat())); - for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.SOURCE; - case REMOVAL: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REMOVAL; - default: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; - case REMOVAL: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REMOVAL; - default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; - } -} - - public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasType()) - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - if (src.hasOptions()) - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.addInitial().setValue(convertType(src.getInitial())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(t)); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasType()) - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - if (src.hasAnswerValueSet()) - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); - for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - if (src.hasQuestion()) - tgt.setQuestion(src.getQuestion()); - if (src.hasHasAnswer()) { - tgt.setOperator(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EXISTS); - tgt.setAnswer(convertType(src.getHasAnswerElement())); - } - else if (src.hasAnswer()) { - tgt.setOperator(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EQUAL); - tgt.setAnswer(convertType(src.getAnswer())); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - if (src.hasQuestion()) - tgt.setQuestion(src.getQuestion()); - if (src.hasOperator() && src.getOperator() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EXISTS) - tgt.setHasAnswer(src.getAnswerBooleanType().getValue()); - else if (src.hasAnswer()) - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.addPartOf(convertReference(t)); - if (src.hasQuestionnaire()) - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasAuthored()) - tgt.setAuthoredElement(convertDateTime(src.getAuthoredElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addParent(convertReference(t)); - if (src.hasQuestionnaire()) - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasAuthored()) - tgt.setAuthoredElement(convertDateTime(src.getAuthoredElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; - default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasText()) - tgt.setText(src.getText()); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasText()) - tgt.setText(src.getText()); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.RelatedPerson tgt = new org.hl7.fhir.r4.model.RelatedPerson(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - if (src.hasActive()) { - tgt.setActive(src.getActive()); - } - if (src.hasPatient()) { - tgt.setPatient(convertReference(src.getPatient())); - } - if (src.hasRelationship()) { - tgt.addRelationship(convertCodeableConcept(src.getRelationship())); - } - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { - tgt.addName(convertHumanName(t)); - } - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { - tgt.addTelecom(convertContactPoint(t)); - } - if (src.hasGender()) { - tgt.setGender(convertAdministrativeGender(src.getGender())); - } - if (src.hasBirthDate()) { - tgt.setBirthDate(tgt.getBirthDate()); - } - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { - tgt.addAddress(convertAddress(t)); - } - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { - tgt.addPhoto(convertAttachment(t)); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r4.model.RelatedPerson src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - if (src.hasActive()) { - tgt.setActive(src.getActive()); - } - if (src.hasPatient()) { - tgt.setPatient(convertReference(src.getPatient())); - } - List relationships = src.getRelationship(); - if (relationships.size() > 0) { - tgt.setRelationship(convertCodeableConcept(relationships.get(0))); - - if (relationships.size() > 1) { - // TODO print a warning that only one relationship could be converted - } - } - for (org.hl7.fhir.r4.model.HumanName t : src.getName()) { - tgt.addName(convertHumanName(t)); - } - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) { - tgt.addTelecom(convertContactPoint(t)); - } - if (src.hasGender()) { - tgt.setGender(convertAdministrativeGender(src.getGender())); - } - if (src.hasBirthDate()) { - tgt.setBirthDate(tgt.getBirthDate()); - } - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) { - tgt.addAddress(convertAddress(t)); - } - for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) { - tgt.addPhoto(convertAttachment(t)); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - - return tgt; - } - - public static org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasBasedOn()) - tgt.setBasedOn(convertReference(src.getBasedOn())); - if (src.hasParent()) - tgt.setParent(convertReference(src.getParent())); - if (src.hasStatus()) - tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasReason()) { - org.hl7.fhir.r4.model.Type t = convertType(src.getReason()); - if (t instanceof org.hl7.fhir.r4.model.CodeableConcept) - tgt.addReasonCode((org.hl7.fhir.r4.model.CodeableConcept) t); - else - tgt.addReasonReference((org.hl7.fhir.r4.model.Reference) t); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - if (src.hasMitigation()) - tgt.setMitigation(src.getMitigation()); - if (src.hasComment()) - tgt.addNote().setText(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasBasedOn()) - tgt.setBasedOn(convertReference(src.getBasedOn())); - if (src.hasParent()) - tgt.setParent(convertReference(src.getParent())); - if (src.hasStatus()) - tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasReasonCode()) - tgt.setReason(convertType(src.getReasonCodeFirstRep())); - if (src.hasReasonReference()) - tgt.setReason(convertType(src.getReasonReferenceFirstRep())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - if (src.hasMitigation()) - tgt.setMitigation(src.getMitigation()); - if (src.hasNote()) - tgt.setComment(src.getNoteFirstRep().getText()); - return tgt; - } - - private static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasProbability()) - tgt.setProbability(convertType(src.getProbability())); - if (src.hasQualitativeRisk()) - tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); - if (src.hasRelativeRisk()) - tgt.setRelativeRisk(src.getRelativeRisk()); - if (src.hasWhen()) - tgt.setWhen(convertType(src.getWhen())); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasProbability()) - tgt.setProbability(convertType(src.getProbability())); - if (src.hasQualitativeRisk()) - tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); - if (src.hasRelativeRisk()) - tgt.setRelativeRisk(src.getRelativeRisk()); - if (src.hasWhen()) - tgt.setWhen(convertType(src.getWhen())); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) - tgt.addActor(convertReference(t)); - if (src.hasPlanningHorizon()) - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getActor()) - tgt.addActor(convertReference(t)); - if (src.hasPlanningHorizon()) - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.addBase(t.getValue()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDerivedFrom()) - tgt.setDerivedFrom(src.getDerivedFrom()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getComparator()) - copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getModifier()) - copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); - for (org.hl7.fhir.dstu3.model.StringType t : src.getChain()) - tgt.addChain(t.getValue()); - for (org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) - tgt.addComponent(convertSearchParameterComponentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) - tgt.addBase(t.getValue()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDerivedFrom()) - tgt.setDerivedFrom(src.getDerivedFrom()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getComparator()) - copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); - for (org.hl7.fhir.r4.model.Enumeration t : src.getModifier()) - copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); - for (org.hl7.fhir.r4.model.StringType t : src.getChain()) - tgt.addChain(t.getValue()); - for (org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) - tgt.addComponent(convertSearchParameterComponentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; - } -} - - private static org.hl7.fhir.r4.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQ: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EQ; - case NE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NE; - case GT: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GT; - case LT: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LT; - case GE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GE; - case LE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LE; - case SA: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.SA; - case EB: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EB; - case AP: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.AP; - default: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r4.model.SearchParameter.SearchComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQ: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EQ; - case NE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NE; - case GT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GT; - case LT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LT; - case GE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GE; - case LE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LE; - case SA: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.SA; - case EB: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EB; - case AP: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.AP; - default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NULL; - } -} - - private static org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MISSING: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.MISSING; - case EXACT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.EXACT; - case CONTAINS: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.CONTAINS; - case NOT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOT; - case TEXT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TEXT; - case IN: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.IN; - case NOTIN: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOTIN; - case BELOW: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.BELOW; - case ABOVE: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.ABOVE; - case TYPE: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TYPE; - default: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MISSING: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.MISSING; - case EXACT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.EXACT; - case CONTAINS: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.CONTAINS; - case NOT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOT; - case TEXT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TEXT; - case IN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOTIN; - case BELOW: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.BELOW; - case ABOVE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.ABOVE; - case TYPE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TYPE; - default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NULL; - } -} - - public static org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent(); - copyElement(src, tgt); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent(); - copyElement(src, tgt); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MolecularSequence tgt = new org.hl7.fhir.r4.model.MolecularSequence(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.setType(convertSequenceType(src.getType())); - if (src.hasCoordinateSystem()) - tgt.setCoordinateSystem(src.getCoordinateSystem()); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasQuantity()) - tgt.setQuantity(convertQuantity(src.getQuantity())); - if (src.hasReferenceSeq()) - tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant()) - tgt.addVariant(convertSequenceVariantComponent(t)); - if (src.hasObservedSeq()) - tgt.setObservedSeq(src.getObservedSeq()); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality()) - tgt.addQuality(convertSequenceQualityComponent(t)); - if (src.hasReadCoverage()) - tgt.setReadCoverage(src.getReadCoverage()); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository()) - tgt.addRepository(convertSequenceRepositoryComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) - tgt.addPointer(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r4.model.MolecularSequence src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.setType(convertSequenceType(src.getType())); - if (src.hasCoordinateSystem()) - tgt.setCoordinateSystem(src.getCoordinateSystem()); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasQuantity()) - tgt.setQuantity(convertQuantity(src.getQuantity())); - if (src.hasReferenceSeq()) - tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); - for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) - tgt.addVariant(convertSequenceVariantComponent(t)); - if (src.hasObservedSeq()) - tgt.setObservedSeq(src.getObservedSeq()); - for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) - tgt.addQuality(convertSequenceQualityComponent(t)); - if (src.hasReadCoverage()) - tgt.setReadCoverage(src.getReadCoverage()); - for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) - tgt.addRepository(convertSequenceRepositoryComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPointer()) - tgt.addPointer(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.dstu3.model.Sequence.SequenceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.AA; - case DNA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.DNA; - case RNA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.RNA; - default: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.SequenceType convertSequenceType(org.hl7.fhir.r4.model.MolecularSequence.SequenceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA; - case DNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA; - case RNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA; - default: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL; - } -} - - public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); - copyElement(src, tgt); - if (src.hasChromosome()) - tgt.setChromosome(convertCodeableConcept(src.getChromosome())); - if (src.hasGenomeBuild()) - tgt.setGenomeBuild(src.getGenomeBuild()); - if (src.hasReferenceSeqId()) - tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); - if (src.hasReferenceSeqPointer()) - tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); - if (src.hasReferenceSeqString()) - tgt.setReferenceSeqString(src.getReferenceSeqString()); -// if (src.hasStrand()) -// tgt.setStrand(src.getStrand()); - if (src.hasWindowStart()) - tgt.setWindowStart(src.getWindowStart()); - if (src.hasWindowEnd()) - tgt.setWindowEnd(src.getWindowEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent(); - copyElement(src, tgt); - if (src.hasChromosome()) - tgt.setChromosome(convertCodeableConcept(src.getChromosome())); - if (src.hasGenomeBuild()) - tgt.setGenomeBuild(src.getGenomeBuild()); - if (src.hasReferenceSeqId()) - tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); - if (src.hasReferenceSeqPointer()) - tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); - if (src.hasReferenceSeqString()) - tgt.setReferenceSeqString(src.getReferenceSeqString()); -// if (src.hasStrand()) -// tgt.setStrand(src.getStrand()); - if (src.hasWindowStart()) - tgt.setWindowStart(src.getWindowStart()); - if (src.hasWindowEnd()) - tgt.setWindowEnd(src.getWindowEnd()); - return tgt; - } - - public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasObservedAllele()) - tgt.setObservedAllele(src.getObservedAllele()); - if (src.hasReferenceAllele()) - tgt.setReferenceAllele(src.getReferenceAllele()); - if (src.hasCigar()) - tgt.setCigar(src.getCigar()); - if (src.hasVariantPointer()) - tgt.setVariantPointer(convertReference(src.getVariantPointer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasObservedAllele()) - tgt.setObservedAllele(src.getObservedAllele()); - if (src.hasReferenceAllele()) - tgt.setReferenceAllele(src.getReferenceAllele()); - if (src.hasCigar()) - tgt.setCigar(src.getCigar()); - if (src.hasVariantPointer()) - tgt.setVariantPointer(convertReference(src.getVariantPointer())); - return tgt; - } - - public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertQualityType(src.getType())); - if (src.hasStandardSequence()) - tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasScore()) - tgt.setScore(convertQuantity(src.getScore())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasTruthTP()) - tgt.setTruthTP(src.getTruthTP()); - if (src.hasQueryTP()) - tgt.setQueryTP(src.getQueryTP()); - if (src.hasTruthFN()) - tgt.setTruthFN(src.getTruthFN()); - if (src.hasQueryFP()) - tgt.setQueryFP(src.getQueryFP()); - if (src.hasGtFP()) - tgt.setGtFP(src.getGtFP()); - if (src.hasPrecision()) - tgt.setPrecision(src.getPrecision()); - if (src.hasRecall()) - tgt.setRecall(src.getRecall()); - if (src.hasFScore()) - tgt.setFScore(src.getFScore()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertQualityType(src.getType())); - if (src.hasStandardSequence()) - tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasScore()) - tgt.setScore(convertQuantity(src.getScore())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasTruthTP()) - tgt.setTruthTP(src.getTruthTP()); - if (src.hasQueryTP()) - tgt.setQueryTP(src.getQueryTP()); - if (src.hasTruthFN()) - tgt.setTruthFN(src.getTruthFN()); - if (src.hasQueryFP()) - tgt.setQueryFP(src.getQueryFP()); - if (src.hasGtFP()) - tgt.setGtFP(src.getGtFP()); - if (src.hasPrecision()) - tgt.setPrecision(src.getPrecision()); - if (src.hasRecall()) - tgt.setRecall(src.getRecall()); - if (src.hasFScore()) - tgt.setFScore(src.getFScore()); - return tgt; - } - - private static org.hl7.fhir.r4.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.dstu3.model.Sequence.QualityType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INDEL: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.INDEL; - case SNP: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.SNP; - case UNKNOWN: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.UNKNOWN; - default: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.QualityType convertQualityType(org.hl7.fhir.r4.model.MolecularSequence.QualityType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INDEL: return org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL; - case SNP: return org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL; - } -} - - public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRepositoryType(src.getType())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDatasetId()) - tgt.setDatasetId(src.getDatasetId()); - if (src.hasVariantsetId()) - tgt.setVariantsetId(src.getVariantsetId()); - if (src.hasReadsetId()) - tgt.setReadsetId(src.getReadsetId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRepositoryType(src.getType())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDatasetId()) - tgt.setDatasetId(src.getDatasetId()); - if (src.hasVariantsetId()) - tgt.setVariantsetId(src.getVariantsetId()); - if (src.hasReadsetId()) - tgt.setReadsetId(src.getReadsetId()); - return tgt; - } - - private static org.hl7.fhir.r4.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.dstu3.model.Sequence.RepositoryType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DIRECTLINK: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.DIRECTLINK; - case OPENAPI: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OPENAPI; - case LOGIN: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.LOGIN; - case OAUTH: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OAUTH; - case OTHER: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OTHER; - default: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.RepositoryType convertRepositoryType(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DIRECTLINK: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK; - case OPENAPI: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI; - case LOGIN: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN; - case OAUTH: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH; - case OTHER: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER; - default: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - if (src.hasSchedule()) - tgt.setSchedule(convertReference(src.getSchedule())); - if (src.hasStatus()) - tgt.setStatus(convertSlotStatus(src.getStatus())); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasOverbooked()) - tgt.setOverbooked(src.getOverbooked()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - if (src.hasSchedule()) - tgt.setSchedule(convertReference(src.getSchedule())); - if (src.hasStatus()) - tgt.setStatus(convertSlotStatus(src.getStatus())); - if (src.hasStart()) - tgt.setStartElement(convertInstant(src.getStartElement())); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasOverbooked()) - tgt.setOverbooked(src.getOverbooked()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Slot.SlotStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Specimen convertSpecimen(org.hl7.fhir.dstu3.model.Specimen src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Specimen tgt = new org.hl7.fhir.r4.model.Specimen(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAccessionIdentifier()) - tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertSpecimenStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasReceivedTime()) - tgt.setReceivedTimeElement(convertDateTime(src.getReceivedTimeElement())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.addParent(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) - tgt.addRequest(convertReference(t)); - if (src.hasCollection()) - tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) - tgt.addProcessing(convertSpecimenProcessingComponent(t)); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) - tgt.addContainer(convertSpecimenContainerComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen convertSpecimen(org.hl7.fhir.r4.model.Specimen src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen tgt = new org.hl7.fhir.dstu3.model.Specimen(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAccessionIdentifier()) - tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertSpecimenStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasReceivedTime()) - tgt.setReceivedTimeElement(convertDateTime(src.getReceivedTimeElement())); - for (org.hl7.fhir.r4.model.Reference t : src.getParent()) - tgt.addParent(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getRequest()) - tgt.addRequest(convertReference(t)); - if (src.hasCollection()) - tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); - for (org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) - tgt.addProcessing(convertSpecimenProcessingComponent(t)); - for (org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent t : src.getContainer()) - tgt.addContainer(convertSpecimenContainerComponent(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.AVAILABLE; - case UNAVAILABLE: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNAVAILABLE; - case UNSATISFACTORY: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNSATISFACTORY; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r4.model.Specimen.SpecimenStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.AVAILABLE; - case UNAVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNAVAILABLE; - case UNSATISFACTORY: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNSATISFACTORY; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent(); - copyElement(src, tgt); - if (src.hasCollector()) - tgt.setCollector(convertReference(src.getCollector())); - if (src.hasCollected()) - tgt.setCollected(convertType(src.getCollected())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent(); - copyElement(src, tgt); - if (src.hasCollector()) - tgt.setCollector(convertReference(src.getCollector())); - if (src.hasCollected()) - tgt.setCollected(convertType(src.getCollected())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasProcedure()) - tgt.setProcedure(convertCodeableConcept(src.getProcedure())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) - tgt.addAdditive(convertReference(t)); - if (src.hasTime()) - tgt.setTime(convertType(src.getTime())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasProcedure()) - tgt.setProcedure(convertCodeableConcept(src.getProcedure())); - for (org.hl7.fhir.r4.model.Reference t : src.getAdditive()) - tgt.addAdditive(convertReference(t)); - if (src.hasTime()) - tgt.setTime(convertType(src.getTime())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCapacity()) - tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); - if (src.hasSpecimenQuantity()) - tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); - if (src.hasAdditive()) - tgt.setAdditive(convertType(src.getAdditive())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCapacity()) - tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); - if (src.hasSpecimenQuantity()) - tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); - if (src.hasAdditive()) - tgt.setAdditive(convertType(src.getAdditive())); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) { - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); - } - for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) - tgt.addContextInvariant(t.getValue()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasDerivation()) - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - if (src.hasDifferential()) - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) { - for (org.hl7.fhir.r4.model.ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); - } - } - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); - } - for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant()) - tgt.addContextInvariant(t.getValue()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasDerivation()) - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - if (src.hasDifferential()) - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - case COMPLEXTYPE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; - } -} - - private static org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource300(tn)) { - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static boolean isResource300(String tn) { - return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", - "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", - "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", - "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", - "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", - "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", - "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", - "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", - "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", - "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", - "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription"); - } - private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap convertStructureMap(org.hl7.fhir.dstu3.model.StructureMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap tgt = new org.hl7.fhir.r4.model.StructureMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap convertStructureMap(org.hl7.fhir.r4.model.StructureMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap tgt = new org.hl7.fhir.dstu3.model.StructureMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasMode()) - tgt.setMode(convertStructureMapModelMode(src.getMode())); - if (src.hasAlias()) - tgt.setAlias(src.getAlias()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasMode()) - tgt.setMode(convertStructureMapModelMode(src.getMode())); - if (src.hasAlias()) - tgt.setAlias(src.getAlias()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.SOURCE; - case QUERIED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.QUERIED; - case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.TARGET; - case PRODUCED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.PRODUCED; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.SOURCE; - case QUERIED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.QUERIED; - case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.TARGET; - case PRODUCED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.PRODUCED; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (src.hasTypeMode()) - tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (src.hasTypeMode()) - tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NONE: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE; - case TYPES: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPES; - case TYPEANDTYPES: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NONE; - case TYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPES; - case TYPEANDTYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasMode()) - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasMode()) - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.FIRST; - case NOTFIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTFIRST; - case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.LAST; - case NOTLAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTLAST; - case ONLYONE: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.ONLYONE; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.FIRST; - case NOTFIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTFIRST; - case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.LAST; - case NOTLAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTLAST; - case ONLYONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.ONLYONE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r4.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL; - } -} - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.FIRST; - case SHARE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.SHARE; - case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.LAST; - case COLLATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.COLLATE; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.FIRST; - case SHARE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.SHARE; - case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.LAST; - case COLLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.COLLATE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.NULL; - } -} - - private static org.hl7.fhir.r4.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CREATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CREATE; - case COPY: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.COPY; - case TRUNCATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRUNCATE; - case ESCAPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ESCAPE; - case CAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CAST; - case APPEND: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.APPEND; - case TRANSLATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRANSLATE; - case REFERENCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.REFERENCE; - case DATEOP: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.DATEOP; - case UUID: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.UUID; - case POINTER: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.POINTER; - case EVALUATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.EVALUATE; - case CC: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CC; - case C: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.C; - case QTY: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.QTY; - case ID: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ID; - case CP: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CP; - default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r4.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CREATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CREATE; - case COPY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.COPY; - case TRUNCATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRUNCATE; - case ESCAPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ESCAPE; - case CAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CAST; - case APPEND: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.APPEND; - case TRANSLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRANSLATE; - case REFERENCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.REFERENCE; - case DATEOP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.DATEOP; - case UUID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.UUID; - case POINTER: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.POINTER; - case EVALUATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.EVALUATE; - case CC: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CC; - case C: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.C; - case QTY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.QTY; - case ID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ID; - case CP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CP; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.NULL; - } -} - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getVariable()) - tgt.addVariable(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.StringType t : src.getVariable()) - tgt.addVariable(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); - copyDomainResource(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasReason()) - tgt.setReason(src.getReason()); - if (src.hasCriteria()) - tgt.setCriteria(src.getCriteria()); - if (src.hasError()) - tgt.setError(src.getError()); - if (src.hasChannel()) - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); - copyDomainResource(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasReason()) - tgt.setReason(src.getReason()); - if (src.hasCriteria()) - tgt.setCriteria(src.getCriteria()); - if (src.hasError()) - tgt.setError(src.getError()); - if (src.hasChannel()) - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - return tgt; - } - - private static org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertSubscriptionChannelType(src.getType())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - if (src.hasPayload()) - tgt.setPayload(src.getPayload()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertSubscriptionChannelType(src.getType())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - if (src.hasPayload()) - tgt.setPayload(src.getPayload()); - for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; - } -} - - public static org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExpiry()) - tgt.setExpiryElement(convertDateTime(src.getExpiryElement())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExpiry()) - tgt.setExpiryElement(convertDateTime(src.getExpiryElement())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public static org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertRatio(src.getQuantity())); - if (src.hasSubstance()) - tgt.setSubstance(convertType(src.getSubstance())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertRatio(src.getQuantity())); - if (src.hasSubstance()) - tgt.setSubstance(convertType(src.getSubstance())); - return tgt; - } - - public static org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSuppliedItem()) - tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasSupplier()) - tgt.setSupplier(convertReference(src.getSupplier())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSuppliedItem()) - tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasSupplier()) - tgt.setSupplier(convertReference(src.getSupplier())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } -} - - public static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - return tgt; - } - - - public static org.hl7.fhir.r4.model.TestReport convertTestReport(org.hl7.fhir.dstu3.model.TestReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport tgt = new org.hl7.fhir.r4.model.TestReport(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertTestReportStatus(src.getStatus())); - if (src.hasTestScript()) - tgt.setTestScript(convertReference(src.getTestScript())); - if (src.hasResult()) - tgt.setResult(convertTestReportResult(src.getResult())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - if (src.hasTester()) - tgt.setTester(src.getTester()); - if (src.hasIssued()) - tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); - for (org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertTestReportParticipantComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent t : src.getTest()) - tgt.addTest(convertTestReportTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport convertTestReport(org.hl7.fhir.r4.model.TestReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport tgt = new org.hl7.fhir.dstu3.model.TestReport(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertTestReportStatus(src.getStatus())); - if (src.hasTestScript()) - tgt.setTestScript(convertReference(src.getTestScript())); - if (src.hasResult()) - tgt.setResult(convertTestReportResult(src.getResult())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - if (src.hasTester()) - tgt.setTester(src.getTester()); - if (src.hasIssued()) - tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); - for (org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertTestReportParticipantComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); - for (org.hl7.fhir.r4.model.TestReport.TestReportTestComponent t : src.getTest()) - tgt.addTest(convertTestReportTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); - return tgt; - } - - private static org.hl7.fhir.r4.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.dstu3.model.TestReport.TestReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.COMPLETED; - case INPROGRESS: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.INPROGRESS; - case WAITING: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.WAITING; - case STOPPED: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.STOPPED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r4.model.TestReport.TestReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.COMPLETED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.INPROGRESS; - case WAITING: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.WAITING; - case STOPPED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.STOPPED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.NULL; - } -} - - private static org.hl7.fhir.r4.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.dstu3.model.TestReport.TestReportResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.r4.model.TestReport.TestReportResult.PASS; - case FAIL: return org.hl7.fhir.r4.model.TestReport.TestReportResult.FAIL; - case PENDING: return org.hl7.fhir.r4.model.TestReport.TestReportResult.PENDING; - default: return org.hl7.fhir.r4.model.TestReport.TestReportResult.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r4.model.TestReport.TestReportResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PASS; - case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.FAIL; - case PENDING: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PENDING; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.NULL; - } -} - - public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTestReportParticipantType(src.getType())); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTestReportParticipantType(src.getType())); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - private static org.hl7.fhir.r4.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TESTENGINE: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.TESTENGINE; - case CLIENT: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.CLIENT; - case SERVER: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.SERVER; - default: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TESTENGINE: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.TESTENGINE; - case CLIENT: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.SERVER; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.NULL; - } -} - - public static org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestReport.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestReport.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - private static org.hl7.fhir.r4.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.PASS; - case SKIP: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.SKIP; - case FAIL: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.FAIL; - case WARNING: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.WARNING; - case ERROR: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.ERROR; - default: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r4.model.TestReport.TestReportActionResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.PASS; - case SKIP: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.SKIP; - case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.FAIL; - case WARNING: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.WARNING; - case ERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.ERROR; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.NULL; - } -} - - public static org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestReport.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r4.model.TestReport.TestReportTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.TestReport.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestReport.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestReport.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestReport.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestReport.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - if (src.hasMetadata()) - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - if (src.hasMetadata()) - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - if (src.hasCapabilities()) - tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getCapabilities())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.r4.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - if (src.hasCapabilities()) - tgt.setCapabilities(convertCanonicalToReference(src.getCapabilitiesElement())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasHint()) - tgt.setHint(src.getHint()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasHint()) - tgt.setHint(src.getHint()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasRequestId()) - tgt.setRequestId(src.getRequestId()); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasRequestId()) - tgt.setRequestId(src.getRequestId()); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static String convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return "application/fhir+xml"; - case JSON: return "application/fhir+json"; - case TTL: return "text/turtle"; - case NONE: return null; - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(String src) throws FHIRException { - if (src == null) - return null; - if (src.contains("xml")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - if (src.contains("json")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - if (src.contains("tu")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.TTL; - return org.hl7.fhir.dstu3.model.TestScript.ContentType.NONE; - } - - - public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - if (src.hasField()) - tgt.setField(src.getField()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - if (src.hasField()) - tgt.setField(src.getField()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourceExpression()) - tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasRequestMethod()) - tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); - if (src.hasRequestURL()) - tgt.setRequestURL(src.getRequestURL()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourceExpression()) - tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasRequestMethod()) - tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); - if (src.hasRequestURL()) - tgt.setRequestURL(src.getRequestURL()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - private static org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; - } -} - - private static org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; - case EVAL: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EVAL; - default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - case EVAL: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EVAL; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; - } -} - - private static org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DELETE: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.DELETE; - case GET: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.GET; - case OPTIONS: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.OPTIONS; - case PATCH: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PATCH; - case POST: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.POST; - case PUT: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PUT; - default: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DELETE: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.DELETE; - case GET: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.GET; - case OPTIONS: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.OPTIONS; - case PATCH: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PATCH; - case POST: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.POST; - case PUT: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PUT; - default: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.NULL; - } -} - - private static org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - if (src.hasCompose()) - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - 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.hasCompose()) - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - if (src.hasLockedDate()) - tgt.setLockedDateElement(convertDate(src.getLockedDateElement())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - if (src.hasLockedDate()) - tgt.setLockedDateElement(convertDate(src.getLockedDateElement())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getValueSet()) - tgt.addValueSet(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getValueSet()) - tgt.addValueSet(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasOp()) - tgt.setOp(convertFilterOperator(src.getOp())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasOp()) - tgt.setOp(convertFilterOperator(src.getOp())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EXISTS; - default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EXISTS; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; - } -} - - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasTimestamp()) - tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasTimestamp()) - tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - -// public static org.hl7.fhir.r4.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu3.model.VisionPrescription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.VisionPrescription tgt = new org.hl7.fhir.r4.model.VisionPrescription(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertVisionStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWrittenElement(convertDateTime(src.getDateWrittenElement())); -// if (src.hasPrescriber()) -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReason()) -// tgt.setReason(convertType(src.getReason())); -// for (org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) -// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r4.model.VisionPrescription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertVisionStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWrittenElement(convertDateTime(src.getDateWrittenElement())); -// if (src.hasPrescriber()) -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReason()) -// tgt.setReason(convertType(src.getReason())); -// for (org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) -// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.r4.model.VisionPrescription.VisionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionDispenseComponent(); -// copyElement(src, tgt); -// if (src.hasProduct()) -// tgt.setProduct(convertCodeableConcept(src.getProduct())); -// if (src.hasEye()) -// tgt.setEye(convertVisionEyes(src.getEye())); -// if (src.hasSphere()) -// tgt.setSphere(src.getSphere()); -// if (src.hasCylinder()) -// tgt.setCylinder(src.getCylinder()); -// if (src.hasAxis()) -// tgt.setAxis(src.getAxis()); -// if (src.hasPrism()) -// tgt.setPrism(src.getPrism()); -// if (src.hasBase()) -// tgt.setBase(convertVisionBase(src.getBase())); -// if (src.hasAdd()) -// tgt.setAdd(src.getAdd()); -// if (src.hasPower()) -// tgt.setPower(src.getPower()); -// if (src.hasBackCurve()) -// tgt.setBackCurve(src.getBackCurve()); -// if (src.hasDiameter()) -// tgt.setDiameter(src.getDiameter()); -// if (src.hasDuration()) -// tgt.setDuration(convertSimpleQuantity(src.getDuration())); -// if (src.hasColor()) -// tgt.setColor(src.getColor()); -// if (src.hasBrand()) -// tgt.setBrand(src.getBrand()); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent(); -// copyElement(src, tgt); -// if (src.hasProduct()) -// tgt.setProduct(convertCodeableConcept(src.getProduct())); -// if (src.hasEye()) -// tgt.setEye(convertVisionEyes(src.getEye())); -// if (src.hasSphere()) -// tgt.setSphere(src.getSphere()); -// if (src.hasCylinder()) -// tgt.setCylinder(src.getCylinder()); -// if (src.hasAxis()) -// tgt.setAxis(src.getAxis()); -// if (src.hasPrism()) -// tgt.setPrism(src.getPrism()); -// if (src.hasBase()) -// tgt.setBase(convertVisionBase(src.getBase())); -// if (src.hasAdd()) -// tgt.setAdd(src.getAdd()); -// if (src.hasPower()) -// tgt.setPower(src.getPower()); -// if (src.hasBackCurve()) -// tgt.setBackCurve(src.getBackCurve()); -// if (src.hasDiameter()) -// tgt.setDiameter(src.getDiameter()); -// if (src.hasDuration()) -// tgt.setDuration(convertSimpleQuantity(src.getDuration())); -// if (src.hasColor()) -// tgt.setColor(src.getColor()); -// if (src.hasBrand()) -// tgt.setBrand(src.getBrand()); -// for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r4.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RIGHT: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.RIGHT; -// case LEFT: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.LEFT; -// default: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r4.model.VisionPrescription.VisionEyes src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RIGHT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.RIGHT; -// case LEFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.LEFT; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.NULL; -// } -//} -// -// private static org.hl7.fhir.r4.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UP: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.UP; -// case DOWN: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.DOWN; -// case IN: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.IN; -// case OUT: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.OUT; -// default: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r4.model.VisionPrescription.VisionBase src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UP: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.UP; -// case DOWN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.DOWN; -// case IN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.IN; -// case OUT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.OUT; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.NULL; -// } -//} - - public static org.hl7.fhir.r4.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition tgt = new org.hl7.fhir.r4.model.PlanDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) - tgt.getLibrary().add(convertReferenceToCanonical(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) - tgt.addGoal(convertPlanDefinitionGoalComponent(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r4.model.PlanDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) - tgt.addLibrary(convertCanonicalToReference(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) - tgt.addGoal(convertPlanDefinitionGoalComponent(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent(); - copyElement(src, tgt); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasStart()) - tgt.setStart(convertCodeableConcept(src.getStart())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses()) - tgt.addAddresses(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) - tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent(); - copyElement(src, tgt); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasStart()) - tgt.setStart(convertCodeableConcept(src.getStart())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAddresses()) - tgt.addAddresses(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) - tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertDuration(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertDuration(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setPrefix(src.getLabel()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasTextEquivalent()) - tgt.setTextEquivalent(src.getTextEquivalent()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) - tgt.addGoalId(t.getValue()); - for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) - tgt.addTrigger(convertTriggerDefinition(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) - tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) - tgt.addInput(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) - tgt.addOutput(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) - tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); - if (src.hasType()) - tgt.getType().addCoding(convertCoding(src.getType())); - if (src.hasGroupingBehavior()) - tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); - if (src.hasSelectionBehavior()) - tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); - if (src.hasRequiredBehavior()) - tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); - if (src.hasPrecheckBehavior()) - tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); - if (src.hasCardinalityBehavior()) - tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); - if (src.hasDefinition()) - tgt.setDefinition(convertReferenceToCanonical(src.getDefinition())); - if (src.hasTransform()) - tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent(); - copyElement(src, tgt); - if (src.hasPrefix()) - tgt.setLabel(src.getPrefix()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasTextEquivalent()) - tgt.setTextEquivalent(src.getTextEquivalent()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.r4.model.IdType t : src.getGoalId()) - tgt.addGoalId(t.getValue()); - for (org.hl7.fhir.r4.model.TriggerDefinition t : src.getTrigger()) - tgt.addTriggerDefinition(convertTriggerDefinition(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) - tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); - for (org.hl7.fhir.r4.model.DataRequirement t : src.getInput()) - tgt.addInput(convertDataRequirement(t)); - for (org.hl7.fhir.r4.model.DataRequirement t : src.getOutput()) - tgt.addOutput(convertDataRequirement(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) - tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); - if (src.hasType()) - tgt.setType(convertCoding(src.getType().getCodingFirstRep())); - if (src.hasGroupingBehavior()) - tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); - if (src.hasSelectionBehavior()) - tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); - if (src.hasRequiredBehavior()) - tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); - if (src.hasPrecheckBehavior()) - tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); - if (src.hasCardinalityBehavior()) - tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); - if (src.hasDefinitionCanonicalType()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionCanonicalType())); - if (src.hasTransform()) - tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); - for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VISUALGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; - case LOGICALGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; - case SENTENCEGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VISUALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; - case LOGICALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; - case SENTENCEGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL; - } -} - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ANY: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ANY; - case ALL: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALL; - case ALLORNONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; - case EXACTLYONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; - case ATMOSTONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; - case ONEORMORE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ANY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY; - case ALL: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL; - case ALLORNONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; - case EXACTLYONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; - case ATMOSTONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; - case ONEORMORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL; - } -} - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MUST: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUST; - case COULD: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.COULD; - case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MUST: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST; - case COULD: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD; - case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL; - } -} - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case YES: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.YES; - case NO: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NO; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case YES: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES; - case NO: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL; - } -} - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SINGLE: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; - case MULTIPLE: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SINGLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL; - } -} - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent(); - copyElement(src, tgt); - if (src.hasKind()) - tgt.setKind(convertActionConditionKind(src.getKind())); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent(); - copyElement(src, tgt); - if (src.hasKind()) - tgt.setKind(convertActionConditionKind(src.getKind())); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPLICABILITY: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.APPLICABILITY; - case START: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.START; - case STOP: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.STOP; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPLICABILITY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY; - case START: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START; - case STOP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL; - } -} - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); - copyElement(src, tgt); - if (src.hasActionId()) - tgt.setActionId(src.getActionId()); - if (src.hasRelationship()) - tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); - if (src.hasOffset()) - tgt.setOffset(convertType(src.getOffset())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); - copyElement(src, tgt); - if (src.hasActionId()) - tgt.setActionId(src.getActionId()); - if (src.hasRelationship()) - tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); - if (src.hasOffset()) - tgt.setOffset(convertType(src.getOffset())); - return tgt; - } - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BEFORESTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORESTART; - case BEFORE: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORE; - case BEFOREEND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFOREEND; - case CONCURRENTWITHSTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; - case CONCURRENT: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENT; - case CONCURRENTWITHEND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; - case AFTERSTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTERSTART; - case AFTER: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTER; - case AFTEREND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTEREND; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BEFORESTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART; - case BEFORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE; - case BEFOREEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND; - case CONCURRENTWITHSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; - case CONCURRENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT; - case CONCURRENTWITHEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; - case AFTERSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART; - case AFTER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER; - case AFTEREND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL; - } -} - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActionParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActionParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - private static org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL; - } -} - - public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); - copyElement(src, tgt); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - public static org.hl7.fhir.r4.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r4.model.Library tgt = new org.hl7.fhir.r4.model.Library(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) - tgt.addParameter(convertParameterDefinition(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) - tgt.addDataRequirement(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) - tgt.addContent(convertAttachment(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Library convertLibrary(org.hl7.fhir.r4.model.Library src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Library tgt = new org.hl7.fhir.dstu3.model.Library(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDateElement()) - tgt.setDateElement(convertDateTime(src.getDateElement())); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); - if (src.hasLastReviewDate()) - tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r4.model.ParameterDefinition t : src.getParameter()) - tgt.addParameter(convertParameterDefinition(t)); - for (org.hl7.fhir.r4.model.DataRequirement t : src.getDataRequirement()) - tgt.addDataRequirement(convertDataRequirement(t)); - for (org.hl7.fhir.r4.model.Attachment t : src.getContent()) - tgt.addContent(convertAttachment(t)); - return tgt; - } - - - - public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.ActivityDefinition) - return convertActivityDefinition((org.hl7.fhir.dstu3.model.ActivityDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.AllergyIntolerance) - return convertAllergyIntolerance((org.hl7.fhir.dstu3.model.AllergyIntolerance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu3.model.Basic) - return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu3.model.Binary) - return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu3.model.BodySite) - return convertBodySite((org.hl7.fhir.dstu3.model.BodySite) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertCapabilityStatement((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); - if (src instanceof org.hl7.fhir.dstu3.model.CareTeam) - return convertCareTeam((org.hl7.fhir.dstu3.model.CareTeam) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Claim) -// return convertClaim((org.hl7.fhir.dstu3.model.Claim) src); - if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.Communication) - return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Composition) - return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.Condition) - return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Consent) - return convertConsent((org.hl7.fhir.dstu3.model.Consent) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Contract) -// return convertContract((org.hl7.fhir.dstu3.model.Contract) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Coverage) -// return convertCoverage((org.hl7.fhir.dstu3.model.Coverage) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Device) -// return convertDevice((org.hl7.fhir.dstu3.model.Device) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) -// return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu3.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Endpoint) - return convertEndpoint((org.hl7.fhir.dstu3.model.Endpoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu3.model.ExpansionProfile) - return convertExpansionProfile((org.hl7.fhir.dstu3.model.ExpansionProfile) src); - if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu3.model.Flag) - return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu3.model.Goal) - return convertGoal((org.hl7.fhir.dstu3.model.Goal) src); - if (src instanceof org.hl7.fhir.dstu3.model.GraphDefinition) - return convertGraphDefinition((org.hl7.fhir.dstu3.model.GraphDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Group) - return convertGroup((org.hl7.fhir.dstu3.model.Group) src); - if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy)src); - if (src instanceof org.hl7.fhir.dstu3.model.Immunization) - return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.Library) - return convertLibrary((org.hl7.fhir.dstu3.model.Library) src); - if (src instanceof org.hl7.fhir.dstu3.model.Linkage) - return convertLinkage((org.hl7.fhir.dstu3.model.Linkage) src); - if (src instanceof org.hl7.fhir.dstu3.model.ListResource) - return convertList((org.hl7.fhir.dstu3.model.ListResource) src); - if (src instanceof org.hl7.fhir.dstu3.model.Location) - return convertLocation((org.hl7.fhir.dstu3.model.Location) src); - if (src instanceof org.hl7.fhir.dstu3.model.Media) - return convertMedia((org.hl7.fhir.dstu3.model.Media) src); - if (src instanceof org.hl7.fhir.dstu3.model.Medication) - return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationAdministration) - return convertMedicationAdministration((org.hl7.fhir.dstu3.model.MedicationAdministration) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationRequest) - return convertMedicationRequest((org.hl7.fhir.dstu3.model.MedicationRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageDefinition) - return convertMessageDefinition((org.hl7.fhir.dstu3.model.MessageDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); -// if (src instanceof org.hl7.fhir.dstu3.model.NutritionOrder) -// return convertNutritionOrder((org.hl7.fhir.dstu3.model.NutritionOrder) src); - if (src instanceof org.hl7.fhir.dstu3.model.Observation) - return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Organization) - return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu3.model.Patient) - return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu3.model.PaymentNotice) - return convertPaymentNotice((org.hl7.fhir.dstu3.model.PaymentNotice) src); - if (src instanceof org.hl7.fhir.dstu3.model.Person) - return convertPerson((org.hl7.fhir.dstu3.model.Person) src); - if (src instanceof org.hl7.fhir.dstu3.model.PlanDefinition) - return convertPlanDefinition((org.hl7.fhir.dstu3.model.PlanDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); - if (src instanceof org.hl7.fhir.dstu3.model.PractitionerRole) - return convertPractitionerRole((org.hl7.fhir.dstu3.model.PractitionerRole) src); - if (src instanceof org.hl7.fhir.dstu3.model.Procedure) - return convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); - if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) - return convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.Provenance) - return convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu3.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Sequence) - return convertSequence((org.hl7.fhir.dstu3.model.Sequence) src); - if (src instanceof org.hl7.fhir.dstu3.model.Slot) - return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu3.model.Specimen) - return convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureMap) - return convertStructureMap((org.hl7.fhir.dstu3.model.StructureMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.Subscription) - return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu3.model.Substance) - return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestReport) - return convertTestReport((org.hl7.fhir.dstu3.model.TestReport) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); -// if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) -// return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src); - if (!nullOk) - throw new FHIRException("Unknown resource "+src.fhirType()); - else - return null; - } - - public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, boolean nullOk) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.r4.model.Parameters) { - if (((org.hl7.fhir.r4.model.Parameters) src).hasParameter("profile-url")) - return convertExpansionProfile((org.hl7.fhir.r4.model.Parameters) src); - else - return convertParameters((org.hl7.fhir.r4.model.Parameters) src); - } - if (src instanceof org.hl7.fhir.r4.model.ActivityDefinition) - return convertActivityDefinition((org.hl7.fhir.r4.model.ActivityDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.AllergyIntolerance) - return convertAllergyIntolerance((org.hl7.fhir.r4.model.AllergyIntolerance) src); - if (src instanceof org.hl7.fhir.r4.model.Appointment) - return convertAppointment((org.hl7.fhir.r4.model.Appointment) src); - if (src instanceof org.hl7.fhir.r4.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.r4.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.r4.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.r4.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.r4.model.Basic) - return convertBasic((org.hl7.fhir.r4.model.Basic) src); - if (src instanceof org.hl7.fhir.r4.model.Binary) - return convertBinary((org.hl7.fhir.r4.model.Binary) src); - if (src instanceof org.hl7.fhir.r4.model.BodyStructure) - return convertBodySite((org.hl7.fhir.r4.model.BodyStructure) src); - if (src instanceof org.hl7.fhir.r4.model.Bundle) - return convertBundle((org.hl7.fhir.r4.model.Bundle) src); - if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) - return convertCapabilityStatement((org.hl7.fhir.r4.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.r4.model.CarePlan) - return convertCarePlan((org.hl7.fhir.r4.model.CarePlan) src); - if (src instanceof org.hl7.fhir.r4.model.CareTeam) - return convertCareTeam((org.hl7.fhir.r4.model.CareTeam) src); -// if (src instanceof org.hl7.fhir.r4.model.Claim) -// return convertClaim((org.hl7.fhir.r4.model.Claim) src); - if (src instanceof org.hl7.fhir.r4.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.r4.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.r4.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.r4.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.r4.model.Communication) - return convertCommunication((org.hl7.fhir.r4.model.Communication) src); - if (src instanceof org.hl7.fhir.r4.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.r4.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.Composition) - return convertComposition((org.hl7.fhir.r4.model.Composition) src); - if (src instanceof org.hl7.fhir.r4.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r4.model.Condition) - return convertCondition((org.hl7.fhir.r4.model.Condition) src); - if (src instanceof org.hl7.fhir.r4.model.Consent) - return convertConsent((org.hl7.fhir.r4.model.Consent) src); -// if (src instanceof org.hl7.fhir.r4.model.Contract) -// return convertContract((org.hl7.fhir.r4.model.Contract) src); -// if (src instanceof org.hl7.fhir.r4.model.Coverage) -// return convertCoverage((org.hl7.fhir.r4.model.Coverage) src); - if (src instanceof org.hl7.fhir.r4.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.r4.model.Device) -// return convertDevice((org.hl7.fhir.r4.model.Device) src); -// if (src instanceof org.hl7.fhir.r4.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.r4.model.DeviceComponent) src); -// if (src instanceof org.hl7.fhir.r4.model.DeviceMetric) -// return convertDeviceMetric((org.hl7.fhir.r4.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.r4.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.r4.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.r4.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.r4.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.r4.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.r4.model.Encounter) - return convertEncounter((org.hl7.fhir.r4.model.Encounter) src); - if (src instanceof org.hl7.fhir.r4.model.Endpoint) - return convertEndpoint((org.hl7.fhir.r4.model.Endpoint) src); - if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.r4.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.r4.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.r4.model.Flag) - return convertFlag((org.hl7.fhir.r4.model.Flag) src); - if (src instanceof org.hl7.fhir.r4.model.Goal) - return convertGoal((org.hl7.fhir.r4.model.Goal) src); - if (src instanceof org.hl7.fhir.r4.model.GraphDefinition) - return convertGraphDefinition((org.hl7.fhir.r4.model.GraphDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.Group) - return convertGroup((org.hl7.fhir.r4.model.Group) src); - if (src instanceof org.hl7.fhir.r4.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.r4.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.r4.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.r4.model.ImagingStudy)src); - if (src instanceof org.hl7.fhir.r4.model.Immunization) - return convertImmunization((org.hl7.fhir.r4.model.Immunization) src); - if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r4.model.Library) - return convertLibrary((org.hl7.fhir.r4.model.Library) src); - if (src instanceof org.hl7.fhir.r4.model.Linkage) - return convertLinkage((org.hl7.fhir.r4.model.Linkage) src); - if (src instanceof org.hl7.fhir.r4.model.ListResource) - return convertList((org.hl7.fhir.r4.model.ListResource) src); - if (src instanceof org.hl7.fhir.r4.model.Location) - return convertLocation((org.hl7.fhir.r4.model.Location) src); - if (src instanceof org.hl7.fhir.r4.model.Media) - return convertMedia((org.hl7.fhir.r4.model.Media) src); - if (src instanceof org.hl7.fhir.r4.model.Medication) - return convertMedication((org.hl7.fhir.r4.model.Medication) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationAdministration) - return convertMedicationAdministration((org.hl7.fhir.r4.model.MedicationAdministration) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.r4.model.MedicationDispense) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationRequest) - return convertMedicationRequest((org.hl7.fhir.r4.model.MedicationRequest) src); - if (src instanceof org.hl7.fhir.r4.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.r4.model.MessageDefinition) - return convertMessageDefinition((org.hl7.fhir.r4.model.MessageDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.r4.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.r4.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); -// if (src instanceof org.hl7.fhir.r4.model.NutritionOrder) -// return convertNutritionOrder((org.hl7.fhir.r4.model.NutritionOrder) src); - if (src instanceof org.hl7.fhir.r4.model.Observation) - return convertObservation((org.hl7.fhir.r4.model.Observation) src); - if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r4.model.Organization) - return convertOrganization((org.hl7.fhir.r4.model.Organization) src); - if (src instanceof org.hl7.fhir.r4.model.Patient) - return convertPatient((org.hl7.fhir.r4.model.Patient) src); - if (src instanceof org.hl7.fhir.r4.model.PaymentNotice) - return convertPaymentNotice((org.hl7.fhir.r4.model.PaymentNotice) src); - if (src instanceof org.hl7.fhir.r4.model.Person) - return convertPerson((org.hl7.fhir.r4.model.Person) src); - if (src instanceof org.hl7.fhir.r4.model.PlanDefinition) - return convertPlanDefinition((org.hl7.fhir.r4.model.PlanDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.Practitioner) - return convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src); - if (src instanceof org.hl7.fhir.r4.model.PractitionerRole) - return convertPractitionerRole((org.hl7.fhir.r4.model.PractitionerRole) src); - if (src instanceof org.hl7.fhir.r4.model.Procedure) - return convertProcedure((org.hl7.fhir.r4.model.Procedure) src); - if (src instanceof org.hl7.fhir.r4.model.ServiceRequest) - return convertProcedureRequest((org.hl7.fhir.r4.model.ServiceRequest) src); - if (src instanceof org.hl7.fhir.r4.model.Provenance) - return convertProvenance((org.hl7.fhir.r4.model.Provenance) src); - if (src instanceof org.hl7.fhir.r4.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r4.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.r4.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.r4.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.r4.model.Schedule) - return convertSchedule((org.hl7.fhir.r4.model.Schedule) src); - if (src instanceof org.hl7.fhir.r4.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r4.model.MolecularSequence) - return convertSequence((org.hl7.fhir.r4.model.MolecularSequence) src); - if (src instanceof org.hl7.fhir.r4.model.Slot) - return convertSlot((org.hl7.fhir.r4.model.Slot) src); - if (src instanceof org.hl7.fhir.r4.model.Specimen) - return convertSpecimen((org.hl7.fhir.r4.model.Specimen) src); - if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.StructureMap) - return convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src); - if (src instanceof org.hl7.fhir.r4.model.Subscription) - return convertSubscription((org.hl7.fhir.r4.model.Subscription) src); - if (src instanceof org.hl7.fhir.r4.model.Substance) - return convertSubstance((org.hl7.fhir.r4.model.Substance) src); - if (src instanceof org.hl7.fhir.r4.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.r4.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.r4.model.TestReport) - return convertTestReport((org.hl7.fhir.r4.model.TestReport) src); - if (src instanceof org.hl7.fhir.r4.model.TestScript) - return convertTestScript((org.hl7.fhir.r4.model.TestScript) src); - if (src instanceof org.hl7.fhir.r4.model.ValueSet) - return convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); -// if (src instanceof org.hl7.fhir.r4.model.VisionPrescription) -// return convertVisionPrescription((org.hl7.fhir.r4.model.VisionPrescription) src); - if (!nullOk) - throw new FHIRException("Unknown resource "+src.fhirType()); - else - return null; - } - - public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src, boolean b) { - TerminologyCapabilities res = new TerminologyCapabilities(); - for (ParametersParameterComponent p : src.getParameter()) { - if (p.getName().equals("system")) - res.addCodeSystem().setUri(p.getValue().primitiveValue()); - } - return res; - } - - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", - "CareTeam", "ClinicalImpression", "CodeSystem", "Communication", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "DetectedIssue", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", - "Encounter", "Endpoint", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImplementationGuide", "Library", "Linkage", "ListResource", "Location", - "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", - "Organization", "Patient", "PaymentNotice", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", - "Sequence", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "TestReport", "TestScript", "ValueSet"); - } - - } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java index 7eb5cf4dc..65c7bf43f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -20,36 +20,16 @@ package org.hl7.fhir.convertors; * #L% */ +import org.hl7.fhir.convertors.conv30_50.*; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.utilities.Utilities; import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.dstu3.model.*; -import org.hl7.fhir.dstu3.model.Contributor.ContributorType; -import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; -import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; -import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; -import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.model.CodeType; -import org.hl7.fhir.r5.model.BooleanType; -import org.hl7.fhir.r5.model.CanonicalType; -import org.hl7.fhir.r5.model.Questionnaire; -import org.hl7.fhir.r5.model.CodeableConcept; -import org.hl7.fhir.r5.model.CodeableReference; -import org.hl7.fhir.r5.model.Enumeration; -import org.hl7.fhir.r5.model.Enumerations; -import org.hl7.fhir.r5.model.Enumerations.ResourceTypeEnum; -import org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent; -import org.hl7.fhir.r5.model.Identifier; -import org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyProcedureComponent; -import org.hl7.fhir.r5.model.Reference; -import org.hl7.fhir.r5.model.TerminologyCapabilities; -import org.hl7.fhir.r5.model.DataType; -import org.hl7.fhir.r5.model.UriType; -import org.hl7.fhir.utilities.Utilities; - - /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,22962 +58,4794 @@ import org.hl7.fhir.utilities.Utilities; POSSIBILITY OF SUCH DAMAGE. */ - - public class VersionConvertor_30_50 { - private static final String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"; - private static List CANONICAL_URLS = new ArrayList<>(); - static { - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); - CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); - } - - private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { - tgt.addExtension(convertExtension(e)); - } + + static final public String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"; + + static public List CANONICAL_URLS = new ArrayList<>(); + + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); } - } - private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { - if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { - tgt.addExtension(convertExtension(e)); - } - } - } - - private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType (src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DecimalType convertInteger64(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue().toString()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu3.model.Reference) - tgt.setValue(convertReferenceToCanonical((org.hl7.fhir.dstu3.model.Reference)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasValue()) - if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) - tgt.setValue(convertCanonicalToReference((org.hl7.fhir.r5.model.CanonicalType)src.getValue())); - else - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - if (src.hasDiv()) - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - if (src.hasDiv()) - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); - copyElement(src, tgt); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(Long.valueOf(src.getSize())); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(Math.toIntExact(src.getSize())); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); - copyElement(src, tgt); - tgt.setCode(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeableConcept convertCodingToCodeableConcept(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.getCodingFirstRep().setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.getCodingFirstRep().setVersion(src.getVersion()); - if (src.hasCode()) - tgt.getCodingFirstRep().setCode(src.getCode()); - if (src.hasDisplay()) - tgt.getCodingFirstRep().setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.getCodingFirstRep().setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); - copyElement(src, tgt); - if (src.hasCoding()) { - if (src.getCodingFirstRep().hasSystem()) - tgt.setSystem(src.getCodingFirstRep().getSystem()); - if (src.getCodingFirstRep().hasVersion()) - tgt.setVersion(src.getCodingFirstRep().getVersion()); - if (src.getCodingFirstRep().hasCode()) - tgt.setCode(src.getCodingFirstRep().getCode()); - if (src.getCodingFirstRep().hasDisplay()) - tgt.setDisplay(src.getCodingFirstRep().getDisplay()); - if (src.getCodingFirstRep().hasUserSelected()) - tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasCoding()) { - if (src.getCodingFirstRep().hasSystem()) - tgt.setSystem(src.getCodingFirstRep().getSystem()); - if (src.getCodingFirstRep().hasVersion()) - tgt.setVersion(src.getCodingFirstRep().getVersion()); - if (src.getCodingFirstRep().hasCode()) - tgt.setCode(src.getCodingFirstRep().getCode()); - if (src.getCodingFirstRep().hasDisplay()) - tgt.setDisplay(src.getCodingFirstRep().getDisplay()); - if (src.getCodingFirstRep().hasUserSelected()) - tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyQuantity(src, tgt); - return tgt; - } - - public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; - } -} - - public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCode()) - tgt.setCurrency(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasCurrency()) - tgt.setCode(src.getCurrency()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static void copyQuantity(org.hl7.fhir.dstu3.model.Quantity src, org.hl7.fhir.r5.model.Quantity tgt) throws FHIRException { - if (src == null || tgt == null) - return; - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - } - - public static void copyQuantity(org.hl7.fhir.r5.model.Quantity src, org.hl7.fhir.dstu3.model.Quantity tgt) throws FHIRException { - if (src == null || tgt == null) - return; - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); -} - - public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; - } -} - - public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); - copyElement(src, tgt); - if (src.hasNumerator()) - tgt.setNumerator(convertQuantity(src.getNumerator())); - if (src.hasDenominator()) - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - if (src.hasNumerator()) - tgt.setNumerator(convertQuantity(src.getNumerator())); - if (src.hasDenominator()) - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); - copyElement(src, tgt); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - if (src.hasDimensions()) - tgt.setDimensions(src.getDimensions()); - if (src.hasData()) - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - if (src.hasDimensions()) - tgt.setDimensions(src.getDimensions()); - if (src.hasData()) - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - if (src.hasWhen()) - tgt.setWhen(src.getWhen()); - if (src.hasWho()) { - if (src.hasWhoUriType()) - tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); - else - tgt.setWho(convertReference(src.getWhoReference())); - } - if (src.hasOnBehalfOf()) { - if (src.hasOnBehalfOfUriType()) - tgt.setOnBehalfOf(new Reference(src.getOnBehalfOfUriType().primitiveValue())); - else - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOfReference())); - } - if (src.hasContentType()) - tgt.setSigFormat(src.getContentType()); - if (src.hasBlob()) - tgt.setData(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - if (src.hasWhen()) - tgt.setWhen(src.getWhen()); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); - if (src.hasSigFormat()) - tgt.setContentType(src.getSigFormat()); - if (src.hasData()) - tgt.setBlob(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertAddressUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertAddressUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r5.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; - } -} - - private static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; - } -} - - public static org.hl7.fhir.r5.model.ContactDetail convertContactDetail(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertContactDetail(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasUse()) - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasUse()) - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; - case SMS: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.SMS; - case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; - case SMS: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; - } -} - - private static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; - } -} - - public static org.hl7.fhir.r5.model.Contributor convertContributor(org.hl7.fhir.dstu3.model.Contributor src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Contributor tgt = new org.hl7.fhir.r5.model.Contributor(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertContributorType(src.getType())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Contributor convertContributor(org.hl7.fhir.r5.model.Contributor src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Contributor tgt = new org.hl7.fhir.dstu3.model.Contributor(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertContributorType(src.getType())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.dstu3.model.Contributor.ContributorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AUTHOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.AUTHOR; - case EDITOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.EDITOR; - case REVIEWER: return org.hl7.fhir.r5.model.Contributor.ContributorType.REVIEWER; - case ENDORSER: return org.hl7.fhir.r5.model.Contributor.ContributorType.ENDORSER; - default: return org.hl7.fhir.r5.model.Contributor.ContributorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r5.model.Contributor.ContributorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AUTHOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.AUTHOR; - case EDITOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.EDITOR; - case REVIEWER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.REVIEWER; - case ENDORSER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.ENDORSER; - default: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.NULL; - } -} - - - public static org.hl7.fhir.r5.model.Dosage convertDosage(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); - copyElement(src, tgt); - if (src.hasSequence()) - tgt.setSequence(src.getSequence()); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAdditionalInstruction()) - tgt.addAdditionalInstruction(convertCodeableConcept(t)); - if (src.hasPatientInstruction()) - tgt.setPatientInstruction(src.getPatientInstruction()); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose() || src.hasRate()) { - org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); - if (src.hasDose()) - dr.setDose(convertType(src.getDose())); - if (src.hasRate()) - dr.setRate(convertType(src.getRate())); - } - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasMaxDosePerAdministration()) - tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); - if (src.hasMaxDosePerLifetime()) - tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Dosage convertDosage(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - if (src.hasSequence()) - tgt.setSequence(src.getSequence()); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalInstruction()) - tgt.addAdditionalInstruction(convertCodeableConcept(t)); - if (src.hasPatientInstruction()) - tgt.setPatientInstruction(src.getPatientInstruction()); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) - tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - if (src.hasMaxDosePerAdministration()) - tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); - if (src.hasMaxDosePerLifetime()) - tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); - if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) - tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasOrderMeaning()) - tgt.setOrderMeaning(src.getOrderMeaning()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) - tgt.addExample(convertElementDefinitionExampleComponent(t)); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (tgt.getIsModifier()) { - String reason = org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); - if (Utilities.noString(reason)) - reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; - tgt.setIsModifierReason(reason); - } - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) - copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) - convertTypeRefComponent(t, tgt.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasOrderMeaning()) - tgt.setOrderMeaning(src.getOrderMeaning()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) - tgt.addExample(convertElementDefinitionExampleComponent(t)); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) - org.hl7.fhir.dstu3.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; - case XHTML: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XHTML; - default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; - case XHTML: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XHTML; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - if (src.hasRules()) - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - if (src.hasRules()) - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertDiscriminatorType(src.getType())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertDiscriminatorType(src.getType())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VALUE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.VALUE; - case EXISTS: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.EXISTS; - case PATTERN: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PATTERN; - case TYPE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.TYPE; - case PROFILE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PROFILE; - default: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VALUE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.VALUE; - case EXISTS: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.EXISTS; - case PATTERN: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PATTERN; - case TYPE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.TYPE; - case PROFILE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PROFILE; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return ; - org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; - for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) - if (t.getCode().equals(src.getCode())) - tgt = t; - if (tgt == null) { - tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCodeElement(convertUri(src.getCodeElement())); - } - if (src.hasProfile()) { - boolean found = false; - for (CanonicalType p: tgt.getProfile()) { - if (p.equals(src.getProfile())) - found = true; - } - if (!found) - tgt.addProfile(src.getProfile()); - } - if (src.hasTargetProfile()) - tgt.addTargetProfile(src.getTargetProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) { - org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); - if (!tgt.hasAggregation(a)) - copyElement(t, tgt.addAggregation(a)); - } - if (src.hasVersioning()) - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - } - - public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { - if (src == null) - return; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertUri(src.getCodeElement())); - list.add(tgt); - if (src.hasTarget()) { - if (src.hasProfile()) - tgt.setProfile(src.getProfile().get(0).getValue()); - for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { - if (tgt.hasTargetProfile()) { - tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile().get(0).getValue()); + static public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... extensionsToIgnore) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { + tgt.addExtension(convertExtension(e)); + } } - tgt.setTargetProfile(u.getValue()); - } - } else { - for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { - if (tgt.hasProfile()) { - tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - list.add(tgt); - copyElement(src, tgt); - tgt.setCode(src.getCode()); + } + + static public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... extensionsToIgnore) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + if (!isExemptExtension(e.getUrl(), extensionsToIgnore)) { + tgt.addExtension(convertExtension(e)); + } } - tgt.setProfile(u.getValue()); - } } - } - private static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; - } -} - - private static org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - if (src.hasKey()) - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - if (src.hasSeverity()) - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - if (src.hasHuman()) - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasSource()) - tgt.setSource(src.getSource()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - if (src.hasKey()) - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - if (src.hasSeverity()) - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - if (src.hasHuman()) - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasSource()) - tgt.setSource(src.getSource()); - return tgt; - } - - private static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt, EXT_SRC_TYPE); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - DataType t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r5.model.Reference) { - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("Reference")); - } else { - tgt.setValueSet(t.primitiveValue()); - tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("uri")); - } - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } } - return tgt; - } - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt, EXT_SRC_TYPE); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasValueSet()) { - org.hl7.fhir.r5.model.Extension ex = src.getValueSetElement().getExtensionByUrl(EXT_SRC_TYPE); - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (ex != null) { - if ("uri".equals(ex.getValue().primitiveValue())) { - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr == null ? src.getValueSet() : vsr)); + static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DecimalType convertInteger64(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue().toString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu3.model.Reference) + tgt.setValue(convertReferenceToCanonical((org.hl7.fhir.dstu3.model.Reference) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((org.hl7.fhir.r5.model.CanonicalType) src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GENERATED: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: + return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(Long.valueOf(src.getSize())); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(Math.toIntExact(src.getSize())); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + tgt.setCode(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodingToCodeableConcept(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.getCodingFirstRep().setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.getCodingFirstRep().setVersion(src.getVersion()); + if (src.hasCode()) + tgt.getCodingFirstRep().setCode(src.getCode()); + if (src.hasDisplay()) + tgt.getCodingFirstRep().setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.getCodingFirstRep().setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: + return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static void copyQuantity(org.hl7.fhir.dstu3.model.Quantity src, org.hl7.fhir.r5.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static void copyQuantity(org.hl7.fhir.r5.model.Quantity src, org.hl7.fhir.dstu3.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.r5.model.Enumerations.QuantityComparator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Enumerations.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LESS_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: + return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) { + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); + else + tgt.setWho(convertReference(src.getWhoReference())); + } + if (src.hasOnBehalfOf()) { + if (src.hasOnBehalfOfUriType()) + tgt.setOnBehalfOf(new Reference(src.getOnBehalfOfUriType().primitiveValue())); + else + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOfReference())); + } + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: + return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + static public org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case POSTAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: + return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: + return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: + return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactDetail convertContactDetail(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertContactDetail(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; + case SMS: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHONE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case URL: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; + case SMS: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + static public org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HOME: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: + return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Contributor convertContributor(org.hl7.fhir.dstu3.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contributor tgt = new org.hl7.fhir.r5.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contributor convertContributor(org.hl7.fhir.r5.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Contributor tgt = new org.hl7.fhir.dstu3.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.dstu3.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AUTHOR: + return org.hl7.fhir.r5.model.Contributor.ContributorType.AUTHOR; + case EDITOR: + return org.hl7.fhir.r5.model.Contributor.ContributorType.EDITOR; + case REVIEWER: + return org.hl7.fhir.r5.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: + return org.hl7.fhir.r5.model.Contributor.ContributorType.ENDORSER; + default: + return org.hl7.fhir.r5.model.Contributor.ContributorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r5.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AUTHOR: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.AUTHOR; + case EDITOR: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.EDITOR; + case REVIEWER: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.ENDORSER; + default: + return org.hl7.fhir.dstu3.model.Contributor.ContributorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Dosage convertDosage(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAdditionalInstruction()) tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertDosage(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalInstruction()) tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) copyElement(t, tgt.addRepresentationElement().setValue(convertPropertyRepresentation(t.getValue()))); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu3.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XHTML; + default: + return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XMLATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XHTML; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + static public org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLOSED: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + static public org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VALUE: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PROFILE; + default: + return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VALUE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PROFILE; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + } + if (src.hasProfile()) { + boolean found = false; + for (CanonicalType p : tgt.getProfile()) { + if (p.equals(src.getProfile())) + found = true; + } + if (!found) + tgt.addProfile(src.getProfile()); + } + if (src.hasTargetProfile()) + tgt.addTargetProfile(src.getTargetProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + copyElement(t, tgt.addAggregation(a)); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + } + + public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + list.add(tgt); + if (src.hasTarget()) { + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + if (tgt.hasTargetProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + } + tgt.setTargetProfile(u.getValue()); + } } else { - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + if (tgt.hasProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + tgt.setProfile(u.getValue()); + } } - } else { - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + } + + static public org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONTAINED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EITHER: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + static public org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ERROR: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: + return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt, EXT_SRC_TYPE); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + DataType t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) { + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("Reference")); + } else { + tgt.setValueSet(t.primitiveValue()); + tgt.getValueSetElement().addExtension(EXT_SRC_TYPE, new UriType("uri")); + } + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt, EXT_SRC_TYPE); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + org.hl7.fhir.r5.model.Extension ex = src.getValueSetElement().getExtensionByUrl(EXT_SRC_TYPE); + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (ex != null) { + if ("uri".equals(ex.getValue().primitiveValue())) { + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr == null ? src.getValueSet() : vsr)); + } else { + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + } else { + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + } + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: + return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case USUAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: + return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ParameterDefinition tgt = new org.hl7.fhir.r5.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(src.getType())); + if (src.hasProfile()) { + tgt.setProfile(convertReference(src.getProfile()).getReference()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r5.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType().toCode()); + if (src.hasProfile()) + tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertParameterUse(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResourceElement(convertReferenceToCanonical(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RelatedArtifact tgt = new org.hl7.fhir.dstu3.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResource(convertCanonicalToReference(src.getResourceElement())); + return tgt; + } + + static public org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENTATION: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: + return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENTATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: + return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDayOfWeek()) copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); + for (org.hl7.fhir.dstu3.model.TimeType t : src.getTimeOfDay()) tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getWhen()) copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDayOfWeek()) copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); + for (org.hl7.fhir.r5.model.TimeType t : src.getTimeOfDay()) tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getWhen()) copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case S: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: + return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDayOfWeek(org.hl7.fhir.dstu3.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.NULL; + } + } + + static public org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MORN: + return org.hl7.fhir.r5.model.Timing.EventTiming.MORN; + case AFT: + return org.hl7.fhir.r5.model.Timing.EventTiming.AFT; + case EVE: + return org.hl7.fhir.r5.model.Timing.EventTiming.EVE; + case NIGHT: + return org.hl7.fhir.r5.model.Timing.EventTiming.NIGHT; + case PHS: + return org.hl7.fhir.r5.model.Timing.EventTiming.PHS; + case HS: + return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MORN: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.MORN; + case AFT: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AFT; + case EVE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.EVE; + case NIGHT: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NIGHT; + case PHS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PHS; + case HS: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: + return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r5.model.UsageContext convertUsageContext(org.hl7.fhir.dstu3.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.UsageContext tgt = new org.hl7.fhir.r5.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UsageContext convertUsageContext(org.hl7.fhir.r5.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.UsageContext tgt = new org.hl7.fhir.dstu3.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.dstu3.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TriggerDefinition tgt = new org.hl7.fhir.r5.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasEventName()) + tgt.setName(src.getEventName()); + if (src.hasEventTiming()) + tgt.setTiming(convertType(src.getEventTiming())); + if (src.hasEventData()) + tgt.addData(convertDataRequirement(src.getEventData())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r5.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TriggerDefinition tgt = new org.hl7.fhir.dstu3.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasName()) + tgt.setEventName(src.getName()); + if (src.hasTiming()) + tgt.setEventTiming(convertType(src.getTiming())); + if (src.hasData()) + tgt.setEventData(convertDataRequirement(src.getDataFirstRep())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement convertDataRequirement(org.hl7.fhir.dstu3.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getMustSupport()) tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement tgt = new org.hl7.fhir.dstu3.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType().toCode()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + DataType t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + for (org.hl7.fhir.dstu3.model.CodeType t : src.getValueCode()) tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getValueCoding()) tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getValueCodeableConcept()) tgt.addCode(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { + tgt.addValueCoding(convertCoding(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r5.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NAMEDEVENT: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: + return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r5.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NAMEDEVENT: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: + return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NULL; + } + } + + public static org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.Contributor) + return convertContributor((org.hl7.fhir.dstu3.model.Contributor) src); + if (src instanceof org.hl7.fhir.dstu3.model.Dosage) + return convertDosage((org.hl7.fhir.dstu3.model.Dosage) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.dstu3.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.dstu3.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu3.model.UsageContext) + return convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.dstu3.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.dstu3.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.dstu3.model.TriggerDefinition) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.Integer64Type) + return convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.r5.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.Contributor) + return convertContributor((org.hl7.fhir.r5.model.Contributor) src); + if (src instanceof org.hl7.fhir.r5.model.Dosage) + return convertDosage((org.hl7.fhir.r5.model.Dosage) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.r5.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.r5.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + if (src instanceof org.hl7.fhir.r5.model.UsageContext) + return convertUsageContext((org.hl7.fhir.r5.model.UsageContext) src); + if (src instanceof org.hl7.fhir.r5.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r5.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.r5.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.r5.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.r5.model.TriggerDefinition) src); + throw new FHIRException("Unknown type " + src.fhirType()); + } + + static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) { + if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t2)); + } + for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) { + if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t3)); + } + } + + static public boolean isExemptExtension(String url, String[] extensionsToIgnore) { + boolean ok = false; + for (String s : extensionsToIgnore) if (s.equals(url)) + ok = true; + return ok; + } + + static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.r5.model.Extension t2 : src.getExtension()) { + if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) + tgt.addExtension(convertExtension(t2)); + } + for (org.hl7.fhir.r5.model.Extension t3 : src.getModifierExtension()) { + if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) + tgt.addModifierExtension(convertExtension(t3)); + } + } + + static public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + static public org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + static public CodeableReference convertReferenceToCodableReference(org.hl7.fhir.dstu3.model.Reference src) { + CodeableReference tgt = new CodeableReference(); + tgt.setReference(convertReference(src)); + return tgt; + } + + static public CodeableReference convertCodeableConceptToCodableReference(org.hl7.fhir.dstu3.model.CodeableConcept src) { + CodeableReference tgt = new CodeableReference(); + tgt.setConcept(convertCodeableConcept(src)); + return tgt; + } + + static public org.hl7.fhir.r5.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + org.hl7.fhir.r5.model.CanonicalType dst = new org.hl7.fhir.r5.model.CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + static public org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + static public org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NUMBER: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: + return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS; + default: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: + return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: + return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: + return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: + return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r5.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL; + } + } + + public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setUse(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasUse()) + tgt.setRole(convertCodeableConcept(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + } + } + + private static final String CODE_SYSTEM_MEDIA_TYPE = "http://terminology.hl7.org/CodeSystem/media-type"; + + public static String convertCoding2Uri(org.hl7.fhir.dstu3.model.Coding code) { + return code.getSystem() + "/" + code.getCode(); + } + + public static org.hl7.fhir.dstu3.model.Coding convertUri2Coding(String uri) { + int i = uri.lastIndexOf("/"); + return new org.hl7.fhir.dstu3.model.Coding().setSystem(uri.substring(0, i)).setCode(uri.substring(i + 1)); + } + + static public org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) tgt.addTarget(convertReference(t)); + if (src.hasPeriod()) + tgt.setOccurred(convertPeriod(src.getPeriod())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) tgt.addReason(convertCodingToCodeableConcept(t)); + if (src.hasActivity()) + tgt.setActivity(convertCodingToCodeableConcept(src.getActivity())); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) tgt.addTarget(convertReference(t)); + if (src.hasOccurredPeriod()) + tgt.setPeriod(convertPeriod(src.getOccurredPeriod())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) for (org.hl7.fhir.r5.model.Coding tc : t.getCoding()) tgt.addReason(convertCoding(tc)); + if (src.hasActivity()) + tgt.setActivity(convertCoding(src.getActivity())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) { + DataType t = convertType(src.getWho()); + if (t instanceof Reference) + tgt.setWho((Reference) t); + if (t instanceof UriType) + tgt.getWho().setReference(t.primitiveValue()); + } + if (src.hasOnBehalfOf()) { + DataType t = convertType(src.getOnBehalfOf()); + if (t instanceof Reference) + tgt.setOnBehalfOf((Reference) t); + if (t instanceof UriType) + tgt.getOnBehalfOf().setReference(t.primitiveValue()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) { + DataType t = convertType(src.getWhat()); + if (t instanceof Reference) + tgt.setWhat((Reference) t); + else if (t instanceof Identifier) + tgt.getWhat().setIdentifier((Identifier) t); + else if (t instanceof UriType) + tgt.getWhat().setReference(t.primitiveValue()); + } + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) + tgt.setWhat(convertType(src.getWhat())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: + return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + static public org.hl7.fhir.r5.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS; + case SKIP: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP; + case FAIL: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL; + case WARNING: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING; + case ERROR: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR; + default: + return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r5.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.PASS; + case SKIP: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.SKIP; + case FAIL: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.FAIL; + case WARNING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.WARNING; + case ERROR: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.ERROR; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(org.hl7.fhir.r5.model.TestScript.FHIRDefinedType.fromCode(src.getResource())); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource().toCode()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public String convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return "application/fhir+xml"; + case JSON: + return "application/fhir+json"; + case TTL: + return "text/turtle"; + case NONE: + return null; + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + if (src.contains("json")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + if (src.contains("tu")) + return org.hl7.fhir.dstu3.model.TestScript.ContentType.TTL; + return org.hl7.fhir.dstu3.model.TestScript.ContentType.NONE; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(org.hl7.fhir.r5.model.TestScript.FHIRDefinedType.fromCode(src.getResource())); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(src.getResource().toCode()); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + static public org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EVAL; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EVAL; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DELETE: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PUT; + default: + return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DELETE: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PUT; + default: + return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.NULL; + } + } + + static public org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS; + default: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return Parameters30_50.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.ActivityDefinition) + return ActivityDefinition30_50.convertActivityDefinition((org.hl7.fhir.dstu3.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.AllergyIntolerance) + return AllergyIntolerance30_50.convertAllergyIntolerance((org.hl7.fhir.dstu3.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Appointment) + return Appointment30_50.convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) + return AppointmentResponse30_50.convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) + return AuditEvent30_50.convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu3.model.Basic) + return Basic30_50.convertBasic((org.hl7.fhir.dstu3.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu3.model.Binary) + return Binary30_50.convertBinary((org.hl7.fhir.dstu3.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu3.model.BodySite) + return BodySite30_50.convertBodySite((org.hl7.fhir.dstu3.model.BodySite) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return Bundle30_50.convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return CapabilityStatement30_50.convertCapabilityStatement((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) + return CarePlan30_50.convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu3.model.CareTeam) + return CareTeam30_50.convertCareTeam((org.hl7.fhir.dstu3.model.CareTeam) src); + if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) + return ClinicalImpression30_50.convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) + return CodeSystem30_50.convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Communication) + return Communication30_50.convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) + return CompartmentDefinition30_50.convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Composition) + return Composition30_50.convertComposition((org.hl7.fhir.dstu3.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return ConceptMap30_50.convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Condition) + return Condition30_50.convertCondition((org.hl7.fhir.dstu3.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Consent) + return Consent30_50.convertConsent((org.hl7.fhir.dstu3.model.Consent) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return DataElement30_50.convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) + return DetectedIssue30_50.convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) + return DeviceUseStatement30_50.convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) + return DiagnosticReport30_50.convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) + return DocumentReference30_50.convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu3.model.Encounter) + return Encounter30_50.convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Endpoint) + return Endpoint30_50.convertEndpoint((org.hl7.fhir.dstu3.model.Endpoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) + return EpisodeOfCare30_50.convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu3.model.ExpansionProfile) + return ExpansionProfile30_50.convertExpansionProfile((org.hl7.fhir.dstu3.model.ExpansionProfile) src); + if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) + return FamilyMemberHistory30_50.convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu3.model.Flag) + return Flag30_50.convertFlag((org.hl7.fhir.dstu3.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu3.model.Goal) + return Goal30_50.convertGoal((org.hl7.fhir.dstu3.model.Goal) src); + if (src instanceof org.hl7.fhir.dstu3.model.GraphDefinition) + return GraphDefinition30_50.convertGraphDefinition((org.hl7.fhir.dstu3.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Group) + return Group30_50.convertGroup((org.hl7.fhir.dstu3.model.Group) src); + if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) + return HealthcareService30_50.convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) + return ImagingStudy30_50.convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.dstu3.model.Immunization) + return Immunization30_50.convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return ImplementationGuide30_50.convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.Library) + return Library30_50.convertLibrary((org.hl7.fhir.dstu3.model.Library) src); + if (src instanceof org.hl7.fhir.dstu3.model.Linkage) + return Linkage30_50.convertLinkage((org.hl7.fhir.dstu3.model.Linkage) src); + if (src instanceof org.hl7.fhir.dstu3.model.ListResource) + return List30_50.convertList((org.hl7.fhir.dstu3.model.ListResource) src); + if (src instanceof org.hl7.fhir.dstu3.model.Location) + return Location30_50.convertLocation((org.hl7.fhir.dstu3.model.Location) src); + if (src instanceof org.hl7.fhir.dstu3.model.Measure) + return Measure30_50.convertMeasure((org.hl7.fhir.dstu3.model.Measure) src); + if (src instanceof org.hl7.fhir.dstu3.model.Media) + return Media30_50.convertMedia((org.hl7.fhir.dstu3.model.Media) src); + if (src instanceof org.hl7.fhir.dstu3.model.Medication) + return Medication30_50.convertMedication((org.hl7.fhir.dstu3.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationAdministration) + return MedicationAdministration30_50.convertMedicationAdministration((org.hl7.fhir.dstu3.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) + return MedicationDispense30_50.convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationRequest) + return MedicationRequest30_50.convertMedicationRequest((org.hl7.fhir.dstu3.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) + return MedicationStatement30_50.convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageDefinition) + return MessageDefinition30_50.convertMessageDefinition((org.hl7.fhir.dstu3.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) + return MessageHeader30_50.convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return NamingSystem30_50.convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Observation) + return Observation30_50.convertObservation((org.hl7.fhir.dstu3.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return OperationDefinition30_50.convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return OperationOutcome30_50.convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Organization) + return Organization30_50.convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu3.model.Patient) + return Patient30_50.convertPatient((org.hl7.fhir.dstu3.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu3.model.PaymentNotice) + return PaymentNotice30_50.convertPaymentNotice((org.hl7.fhir.dstu3.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.dstu3.model.Person) + return Person30_50.convertPerson((org.hl7.fhir.dstu3.model.Person) src); + if (src instanceof org.hl7.fhir.dstu3.model.PlanDefinition) + return PlanDefinition30_50.convertPlanDefinition((org.hl7.fhir.dstu3.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) + return Practitioner30_50.convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu3.model.PractitionerRole) + return PractitionerRole30_50.convertPractitionerRole((org.hl7.fhir.dstu3.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return Questionnaire30_50.convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return QuestionnaireResponse30_50.convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) + return RelatedPerson30_50.convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) + return RiskAssessment30_50.convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu3.model.Schedule) + return Schedule30_50.convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return SearchParameter30_50.convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Sequence) + return Sequence30_50.convertSequence((org.hl7.fhir.dstu3.model.Sequence) src); + if (src instanceof org.hl7.fhir.dstu3.model.Slot) + return Slot30_50.convertSlot((org.hl7.fhir.dstu3.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu3.model.Specimen) + return Specimen30_50.convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return StructureDefinition30_50.convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureMap) + return StructureMap30_50.convertStructureMap((org.hl7.fhir.dstu3.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Substance) + return Substance30_50.convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) + return SupplyDelivery30_50.convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestReport) + return TestReport30_50.convertTestReport((org.hl7.fhir.dstu3.model.TestReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return TestScript30_50.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return ValueSet30_50.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); + if (!nullOk) + throw new FHIRException("Unknown resource " + src.fhirType()); else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } + return null; } - return tgt; - } - private static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; - } -} - - public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasMap()) - tgt.setMap(src.getMap()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasMap()) - tgt.setMap(src.getMap()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.setFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.setFamily(src.getFamily()); - for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; - } -} - - public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r5.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ParameterDefinition tgt = new org.hl7.fhir.r5.model.ParameterDefinition(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(src.getType())); - if (src.hasProfile()) { - tgt.setProfile(convertReference(src.getProfile()).getReference()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r5.model.ParameterDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType().toCode()); - if (src.hasProfile()) - tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertParameterUse(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; - default: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL; - } -} - - public static org.hl7.fhir.r5.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRelatedArtifactType(src.getType())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasCitation()) - tgt.setCitation(src.getCitation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDocument()) - tgt.setDocument(convertAttachment(src.getDocument())); - if (src.hasResource()) - tgt.setResourceElement(convertReferenceToCanonical(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RelatedArtifact tgt = new org.hl7.fhir.dstu3.model.RelatedArtifact(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRelatedArtifactType(src.getType())); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasCitation()) - tgt.setCitation(src.getCitation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDocument()) - tgt.setDocument(convertAttachment(src.getDocument())); - if (src.hasResource()) - tgt.setResource(convertCanonicalToReference(src.getResourceElement())); - return tgt; - } - - private static org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENTATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; - case JUSTIFICATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; - case CITATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.CITATION; - case PREDECESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; - case SUCCESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; - case DERIVEDFROM: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; - case DEPENDSON: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; - case COMPOSEDOF: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; - default: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENTATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; - case JUSTIFICATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; - case CITATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.CITATION; - case PREDECESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; - case SUCCESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; - case DERIVEDFROM: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; - case DEPENDSON: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; - case COMPOSEDOF: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; - default: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - if (src.hasRepeat()) - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - if (src.hasRepeat()) - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - if (src.hasDurationUnit()) - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - if (src.hasPeriodUnit()) - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDayOfWeek()) - copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); - for (org.hl7.fhir.dstu3.model.TimeType t : src.getTimeOfDay()) - tgt.addTimeOfDay(t.getValue()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getWhen()) - copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - if (src.hasDurationUnit()) - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - if (src.hasPeriodUnit()) - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (org.hl7.fhir.r5.model.Enumeration t : src.getDayOfWeek()) - copyElement(t, tgt.addDayOfWeekElement().setValue(convertDayOfWeek(t.getValue()))); - for (org.hl7.fhir.r5.model.TimeType t : src.getTimeOfDay()) - tgt.addTimeOfDay(t.getValue()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getWhen()) - copyElement(t, tgt.addWhenElement().setValue(convertEventTiming(t.getValue()))); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDayOfWeek(org.hl7.fhir.dstu3.model.Timing.DayOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; - default: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.NULL; - } -} - - private static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MORN: return org.hl7.fhir.r5.model.Timing.EventTiming.MORN; - case AFT: return org.hl7.fhir.r5.model.Timing.EventTiming.AFT; - case EVE: return org.hl7.fhir.r5.model.Timing.EventTiming.EVE; - case NIGHT: return org.hl7.fhir.r5.model.Timing.EventTiming.NIGHT; - case PHS: return org.hl7.fhir.r5.model.Timing.EventTiming.PHS; - case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MORN: return org.hl7.fhir.dstu3.model.Timing.EventTiming.MORN; - case AFT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AFT; - case EVE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.EVE; - case NIGHT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NIGHT; - case PHS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PHS; - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; - } -} - - public static org.hl7.fhir.r5.model.UsageContext convertUsageContext(org.hl7.fhir.dstu3.model.UsageContext src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.UsageContext tgt = new org.hl7.fhir.r5.model.UsageContext(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCoding(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UsageContext convertUsageContext(org.hl7.fhir.r5.model.UsageContext src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.UsageContext tgt = new org.hl7.fhir.dstu3.model.UsageContext(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCoding(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasComparator()) - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.r5.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.dstu3.model.TriggerDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TriggerDefinition tgt = new org.hl7.fhir.r5.model.TriggerDefinition(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTriggerType(src.getType())); - if (src.hasEventName()) - tgt.setName(src.getEventName()); - if (src.hasEventTiming()) - tgt.setTiming(convertType(src.getEventTiming())); - if (src.hasEventData()) - tgt.addData(convertDataRequirement(src.getEventData())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r5.model.TriggerDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TriggerDefinition tgt = new org.hl7.fhir.dstu3.model.TriggerDefinition(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTriggerType(src.getType())); - if (src.hasName()) - tgt.setEventName(src.getName()); - if (src.hasTiming()) - tgt.setEventTiming(convertType(src.getTiming())); - if (src.hasData()) - tgt.setEventData(convertDataRequirement(src.getDataFirstRep())); - return tgt; - } - - public static org.hl7.fhir.r5.model.DataRequirement convertDataRequirement(org.hl7.fhir.dstu3.model.DataRequirement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getMustSupport()) - tgt.addMustSupport(t.getValue()); - for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) - tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) - tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement tgt = new org.hl7.fhir.dstu3.model.DataRequirement(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType().toCode()); - for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) - tgt.addMustSupport(t.getValue()); - for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) - tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); - for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) - tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValueSet()) { - DataType t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r5.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - for (org.hl7.fhir.dstu3.model.CodeType t : src.getValueCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getValueCoding()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getValueCodeableConcept()) - tgt.addCode(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { - tgt.addValueCoding(convertCoding(t)); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - - private static org.hl7.fhir.r5.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NAMEDEVENT: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NAMEDEVENT; - case PERIODIC: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.PERIODIC; - case DATAADDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAADDED; - case DATAMODIFIED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAMODIFIED; - case DATAREMOVED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAREMOVED; - case DATAACCESSED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSED; - case DATAACCESSENDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSENDED; - default: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r5.model.TriggerDefinition.TriggerType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NAMEDEVENT: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NAMEDEVENT; - case PERIODIC: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.PERIODIC; - case DATAADDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAADDED; - case DATAMODIFIED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAMODIFIED; - case DATAREMOVED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAREMOVED; - case DATAACCESSED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSED; - case DATAACCESSENDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSENDED; - default: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NULL; - } -} - - - public static org.hl7.fhir.r5.model.DataType convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactDetail) - return convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.Contributor) - return convertContributor((org.hl7.fhir.dstu3.model.Contributor) src); - if (src instanceof org.hl7.fhir.dstu3.model.Dosage) - return convertDosage((org.hl7.fhir.dstu3.model.Dosage) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.ParameterDefinition) - return convertParameterDefinition((org.hl7.fhir.dstu3.model.ParameterDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedArtifact) - return convertRelatedArtifact((org.hl7.fhir.dstu3.model.RelatedArtifact) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu3.model.UsageContext) - return convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataRequirement) - return convertDataRequirement((org.hl7.fhir.dstu3.model.DataRequirement) src); - if (src instanceof org.hl7.fhir.dstu3.model.TriggerDefinition) - return convertTriggerDefinition((org.hl7.fhir.dstu3.model.TriggerDefinition) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.r5.model.DataType src) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r5.model.BooleanType) - return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r5.model.CodeType) - return convertCode((org.hl7.fhir.r5.model.CodeType) src); - if (src instanceof org.hl7.fhir.r5.model.DateType) - return convertDate((org.hl7.fhir.r5.model.DateType) src); - if (src instanceof org.hl7.fhir.r5.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r5.model.DecimalType) - return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r5.model.IdType) - return convertId((org.hl7.fhir.r5.model.IdType) src); - if (src instanceof org.hl7.fhir.r5.model.InstantType) - return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r5.model.Integer64Type) - return convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src); - if (src instanceof org.hl7.fhir.r5.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r5.model.OidType) - return convertOid((org.hl7.fhir.r5.model.OidType) src); - if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r5.model.StringType) - return convertString((org.hl7.fhir.r5.model.StringType) src); - if (src instanceof org.hl7.fhir.r5.model.TimeType) - return convertTime((org.hl7.fhir.r5.model.TimeType) src); - if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r5.model.UriType) - return convertUri((org.hl7.fhir.r5.model.UriType) src); - if (src instanceof org.hl7.fhir.r5.model.UuidType) - return convertUuid((org.hl7.fhir.r5.model.UuidType) src); - if (src instanceof org.hl7.fhir.r5.model.Extension) - return convertExtension((org.hl7.fhir.r5.model.Extension) src); - if (src instanceof org.hl7.fhir.r5.model.Narrative) - return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); - if (src instanceof org.hl7.fhir.r5.model.Age) - return convertAge((org.hl7.fhir.r5.model.Age) src); - if (src instanceof org.hl7.fhir.r5.model.Annotation) - return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); - if (src instanceof org.hl7.fhir.r5.model.Attachment) - return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); - if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r5.model.Coding) - return convertCoding((org.hl7.fhir.r5.model.Coding) src); - if (src instanceof org.hl7.fhir.r5.model.Count) - return convertCount((org.hl7.fhir.r5.model.Count) src); - if (src instanceof org.hl7.fhir.r5.model.Distance) - return convertDistance((org.hl7.fhir.r5.model.Distance) src); - if (src instanceof org.hl7.fhir.r5.model.Duration) - return convertDuration((org.hl7.fhir.r5.model.Duration) src); - if (src instanceof org.hl7.fhir.r5.model.Identifier) - return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); - if (src instanceof org.hl7.fhir.r5.model.Money) - return convertMoney((org.hl7.fhir.r5.model.Money) src); - if (src instanceof org.hl7.fhir.r5.model.Period) - return convertPeriod((org.hl7.fhir.r5.model.Period) src); - if (src instanceof org.hl7.fhir.r5.model.Quantity) - return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); - if (src instanceof org.hl7.fhir.r5.model.Range) - return convertRange((org.hl7.fhir.r5.model.Range) src); - if (src instanceof org.hl7.fhir.r5.model.Ratio) - return convertRatio((org.hl7.fhir.r5.model.Ratio) src); - if (src instanceof org.hl7.fhir.r5.model.Reference) - return convertReference((org.hl7.fhir.r5.model.Reference) src); - if (src instanceof org.hl7.fhir.r5.model.SampledData) - return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); - if (src instanceof org.hl7.fhir.r5.model.Signature) - return convertSignature((org.hl7.fhir.r5.model.Signature) src); - if (src instanceof org.hl7.fhir.r5.model.Address) - return convertAddress((org.hl7.fhir.r5.model.Address) src); - if (src instanceof org.hl7.fhir.r5.model.ContactDetail) - return convertContactDetail((org.hl7.fhir.r5.model.ContactDetail) src); - if (src instanceof org.hl7.fhir.r5.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r5.model.Contributor) - return convertContributor((org.hl7.fhir.r5.model.Contributor) src); - if (src instanceof org.hl7.fhir.r5.model.Dosage) - return convertDosage((org.hl7.fhir.r5.model.Dosage) src); - if (src instanceof org.hl7.fhir.r5.model.HumanName) - return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); - if (src instanceof org.hl7.fhir.r5.model.Meta) - return convertMeta((org.hl7.fhir.r5.model.Meta) src); - if (src instanceof org.hl7.fhir.r5.model.ParameterDefinition) - return convertParameterDefinition((org.hl7.fhir.r5.model.ParameterDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.RelatedArtifact) - return convertRelatedArtifact((org.hl7.fhir.r5.model.RelatedArtifact) src); - if (src instanceof org.hl7.fhir.r5.model.Timing) - return convertTiming((org.hl7.fhir.r5.model.Timing) src); - if (src instanceof org.hl7.fhir.r5.model.UsageContext) - return convertUsageContext((org.hl7.fhir.r5.model.UsageContext) src); - if (src instanceof org.hl7.fhir.r5.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.r5.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.DataRequirement) - return convertDataRequirement((org.hl7.fhir.r5.model.DataRequirement) src); - if (src instanceof org.hl7.fhir.r5.model.TriggerDefinition) - return convertTriggerDefinition((org.hl7.fhir.r5.model.TriggerDefinition) src); - throw new FHIRException("Unknown type "+src.fhirType()); - } - - private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) - tgt.addContained(convertResource(t1, false)); - for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) { - if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t2)); - } - for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) { - if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t3)); - } - } - - private static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - boolean ok = false; - for (String s : extensionsToIgnore) - if (s.equals(url)) - ok = true; - return ok; - } - - private static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r5.model.Resource t1 : src.getContained()) - tgt.addContained(convertResource(t1, false)); - for (org.hl7.fhir.r5.model.Extension t2 : src.getExtension()) { - if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) - tgt.addExtension(convertExtension(t2)); - } - for (org.hl7.fhir.r5.model.Extension t3 : src.getModifierExtension()) { - if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) - tgt.addModifierExtension(convertExtension(t3)); - } - } - public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - - public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) - tgt.getLibrary().add(convertReferenceToCanonical(t)); - if (src.hasKind()) - tgt.setKind(convertActivityDefinitionKind(src.getKind())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); - if (src.hasProduct()) - tgt.setProduct(convertType(src.getProduct())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasTransform()) - tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); - for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) - tgt.addLibrary(convertCanonicalToReference(t)); - if (src.hasKind()) - tgt.setKind(convertActivityDefinitionKind(src.getKind())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); - if (src.hasProduct()) - tgt.setProduct(convertType(src.getProduct())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasTransform()) - tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); - for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPOINTMENT: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.APPOINTMENT; - case APPOINTMENTRESPONSE: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.APPOINTMENTRESPONSE; - case CAREPLAN: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CAREPLAN; - case CLAIM: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CLAIM; - case COMMUNICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.COMMUNICATIONREQUEST; - case CONTRACT: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CONTRACT; - case DEVICEREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.DEVICEREQUEST; - case ENROLLMENTREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.ENROLLMENTREQUEST; - case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.IMMUNIZATIONRECOMMENDATION; - case MEDICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.MEDICATIONREQUEST; - case NUTRITIONORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.NUTRITIONORDER; - case PROCEDUREREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SERVICEREQUEST; - case REFERRALREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SERVICEREQUEST; - case SUPPLYREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SUPPLYREQUEST; - case TASK: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.TASK; - case VISIONPRESCRIPTION: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.VISIONPRESCRIPTION; - default: return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPOINTMENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; - case APPOINTMENTRESPONSE: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; - case CAREPLAN: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; - case CLAIM: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; - case COMMUNICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; - case CONTRACT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; - case DEVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; - case ENROLLMENTREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; - case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; - case MEDICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; - case NUTRITIONORDER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; - case SERVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST; - case SUPPLYREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; - case TASK: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK; - case VISIONPRESCRIPTION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; - default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL; - } -} - - public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActivityParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActivityParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ActionParticipantType convertActivityParticipantType(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL; - } -} - - public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); - if (src.hasType()) - tgt.setType(convertAllergyIntoleranceType(src.getType())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getCategory()) - copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); - if (src.hasCriticality()) - tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAssertedDate()) - tgt.setRecordedDate(src.getAssertedDate()); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasLastOccurrence()) - tgt.setLastOccurrence(src.getLastOccurrence()); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) - tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); - if (src.hasType()) - tgt.setType(convertAllergyIntoleranceType(src.getType())); - for (org.hl7.fhir.r5.model.Enumeration t : src.getCategory()) - copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); - if (src.hasCriticality()) - tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasRecordedDate()) - tgt.setAssertedDate(src.getRecordedDate()); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasLastOccurrence()) - tgt.setLastOccurrence(src.getLastOccurrence()); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) - tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); - case INACTIVE: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); - case RESOLVED: new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; - } - - private static org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNCONFIRMED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); - case CONFIRMED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); - case REFUTED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); - case ENTEREDINERROR: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; - if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; - } - - private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ALLERGY: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; - case INTOLERANCE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; - default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ALLERGY: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; - case INTOLERANCE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL; - } -} - - private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FOOD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; - case MEDICATION: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; - case ENVIRONMENT: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; - case BIOLOGIC: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; - default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FOOD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; - case MEDICATION: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; - case ENVIRONMENT: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; - case BIOLOGIC: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; - } -} - - private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LOW: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; - case HIGH: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; - case UNABLETOASSESS: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; - default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LOW: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; - case HIGH: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; - case UNABLETOASSESS: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; - } -} - - public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); - copyElement(src, tgt); - if (src.hasSubstance()) - tgt.setSubstance(convertCodeableConcept(src.getSubstance())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) - tgt.addManifestation(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOnset()) - tgt.setOnset(src.getOnset()); - if (src.hasSeverity()) - tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); - if (src.hasExposureRoute()) - tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); - copyElement(src, tgt); - if (src.hasSubstance()) - tgt.setSubstance(convertCodeableConcept(src.getSubstance())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) - tgt.addManifestation(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOnset()) - tgt.setOnset(src.getOnset()); - if (src.hasSeverity()) - tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); - if (src.hasExposureRoute()) - tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MILD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; - case MODERATE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; - case SEVERE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; - default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MILD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; - case MODERATE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; - case SEVERE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; - default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; - } -} - - private static CodeableReference convertReferenceToCodableReference(org.hl7.fhir.dstu3.model.Reference src) { - CodeableReference tgt = new CodeableReference(); - tgt.setReference(convertReference(src)); - return tgt; - } - - private static CodeableReference convertCodeableConceptToCodableReference(org.hl7.fhir.dstu3.model.CodeableConcept src) { - CodeableReference tgt = new CodeableReference(); - tgt.setConcept(convertCodeableConcept(src)); - return tgt; - } - - - - public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) - tgt.addReason(convertReferenceToCodableReference(t)); - if (src.hasPriority()) - tgt.setPriority(src.getPriority()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasMinutesDuration()) - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) - tgt.addRequestedPeriod(convertPeriod(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReason(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addIndication(convertReference(t.getReference())); - if (src.hasPriority()) - tgt.setPriority(src.getPriority()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasMinutesDuration()) - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - for (org.hl7.fhir.r5.model.Period t : src.getRequestedPeriod()) - tgt.addRequestedPeriod(convertPeriod(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); - if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); - if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointment())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointment())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) - tgt.addSubtype(convertCoding(t)); - if (src.hasAction()) - tgt.setAction(convertAuditEventAction(src.getAction())); - if (src.hasRecorded()) - tgt.setRecorded(src.getRecorded()); - if (src.hasOutcome()) - tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); - if (src.hasOutcomeDesc()) - tgt.setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) - tgt.addPurposeOfEvent(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - if (src.hasSource()) - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) - tgt.addSubtype(convertCoding(t)); - if (src.hasAction()) - tgt.setAction(convertAuditEventAction(src.getAction())); - if (src.hasRecorded()) - tgt.setRecorded(src.getRecorded()); - if (src.hasOutcome()) - tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); - if (src.hasOutcomeDesc()) - tgt.setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) - tgt.addPurposeOfEvent(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - if (src.hasSource()) - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; - } -} - - private static org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; - } -} - - public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasReference()) - tgt.setWho(convertReference(src.getReference())); - if (src.hasUserId()) - tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); - if (src.hasAltId()) - tgt.setAltId(src.getAltId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRequestor()) - tgt.setRequestor(src.getRequestor()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasMedia()) - tgt.setMedia(convertCoding(src.getMedia())); - if (src.hasNetwork()) - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) - tgt.addPurposeOfUse(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - if (src.getWho().hasIdentifier()) - tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); - if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) - tgt.setReference(convertReference(src.getWho())); - } - if (src.hasAltId()) - tgt.setAltId(src.getAltId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRequestor()) - tgt.setRequestor(src.getRequestor()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasMedia()) - tgt.setMedia(convertCoding(src.getMedia())); - if (src.hasNetwork()) - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) - tgt.addPurposeOfUse(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - if (src.hasType()) - tgt.setType(convertAuditEventAgentNetworkType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - if (src.hasType()) - tgt.setType(convertAuditEventAgentNetworkType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } -} - - public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - if (src.hasSite()) - tgt.setSite(src.getSite()); - if (src.hasIdentifier()) - tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - if (src.hasSite()) - tgt.setSite(src.getSite()); - if (src.hasObserver()) - tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); - for (org.hl7.fhir.r5.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasReference()) - tgt.setWhat(convertReference(src.getReference())); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCoding(src.getRole())); - if (src.hasLifecycle()) - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - if (src.hasName()) - tgt.setName(src.getName()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); - if (src.hasQuery()) - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - if (src.hasWhat()) { - if (src.getWhat().hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); - if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) - tgt.setReference(convertReference(src.getWhat())); - } - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCoding(src.getRole())); - if (src.hasLifecycle()) - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - if (src.hasName()) - tgt.setName(src.getName()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); - if (src.hasQuery()) - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasValue()) - tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasValueStringType()) - tgt.setValue(src.getValueStringType().getValue().getBytes()); - else if (src.hasValueBase64BinaryType()) - tgt.setValue(src.getValueBase64BinaryType().getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); - copyResource(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasSecurityContext()) - tgt.setSecurityContext(convertReference(src.getSecurityContext())); - if (src.hasContent()) - tgt.setData(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasSecurityContext()) - tgt.setSecurityContext(convertReference(src.getSecurityContext())); - if (src.hasData()) - tgt.setContent(src.getData()); - return tgt; - } - - public static org.hl7.fhir.r5.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getQualifier()) -// tgt.addQualifier(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) - tgt.addImage(convertAttachment(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getQualifier()) -// tgt.addQualifier(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) - tgt.addImage(convertAttachment(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); - copyResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - if (src.hasRelation()) - tgt.setRelation(src.getRelation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - if (src.hasRelation()) - tgt.setRelation(src.getRelation()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - if (src.hasResource()) - tgt.setResource(convertResource(src.getResource(), false)); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; - } -} - - public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - if (src.hasOutcome()) - tgt.setOutcome(convertResource(src.getOutcome(), false)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - if (src.hasOutcome()) - tgt.setOutcome(convertResource(src.getOutcome(), false)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasKind()) - tgt.setKind(convertCapabilityStatementKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) - tgt.addInstantiates(t.getValue()); - if (src.hasSoftware()) - tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); - 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())); - 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", 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()) - tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown", "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasKind()) - tgt.setKind(convertCapabilityStatementKind(src.getKind())); - for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) - tgt.addInstantiates(t.getValue()); - if (src.hasSoftware()) - tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - 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())); - 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()); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) - for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) - tgt.addProfile(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())) { - tgt.addProfile(convertReference((org.hl7.fhir.r5.model.Reference) ext.getValue())); - } - } - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertCapabilityStatementRestComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } -} - -// private static org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; -// case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; -// case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; -// case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; -// default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; -// } -//} - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertRestfulCapabilityMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSecurity()) - tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertRestfulCapabilityMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSecurity()) - tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) - tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalRead()) - tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getReferencePolicy()) - copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - org.hl7.fhir.r5.model.CanonicalType dst = new org.hl7.fhir.r5.model.CanonicalType(src.getReference()); - copyElement(src, dst); - return dst; - } - - private static org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue()); - copyElement(src, dst); - return dst; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalRead()) - tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r5.model.Enumeration t : src.getReferencePolicy()) - copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } -} - - private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; - case MODIFIEDSINCE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; - case NOTMATCH: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; - case FULLSUPPORT: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; - case MODIFIEDSINCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; - case NOTMATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; - case FULLSUPPORT: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LITERAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; - case LOGICAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; - case RESOLVES: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; - case ENFORCED: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; - case LOCAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; - default: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LITERAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; - case LOGICAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; - case RESOLVES: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; - case ENFORCED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; - case LOCAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; - } -} - - public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case PATCH: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.PATCH; - case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case PATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.PATCH; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } -} - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } -} - - public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case BATCH: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.BATCH; - case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case BATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.BATCH; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } -} - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) - tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) { - org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); - e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode()))); - if (t.hasCategory()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); - if (t.getFocusElement().hasValue()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); - else { - org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); - org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); - copyElement(t.getFocusElement(), focus); - e.addExtension(focusE); - } - e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest()))); - e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse()))); - if (t.hasDocumentation()) - e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); - tgt.addExtension(e); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) - tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); - for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - tgt.addEvent(event); - event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue())); - if (e.hasExtension("category")) - event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); - event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); - org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); - if (focusE.getValue().hasPrimitiveValue()) - event.setFocus(focusE.getValue().toString()); - else { - event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType()); - copyElement(focusE.getValue(), event.getFocusElement()); - } - event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue())); - event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue())); - if (e.hasExtension("documentation")) - event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - if (src.hasProtocol()) - tgt.setProtocol(convertCoding(src.getProtocol())); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - if (src.hasProtocol()) - tgt.setProtocol(convertCoding(src.getProtocol())); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertEventCapabilityMode(src.getMode())); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertEventCapabilityMode(src.getMode())); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } -} - - - public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - private static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } -} - - - public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertCarePlanIntent(src.getIntent())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - List authors = src.getAuthor(); - if (authors.size() > 0) { - tgt.setAuthor(convertReference(authors.get(0))); - if (authors.size() > 1) { - // TODO print a warning that only one author could be converted - } - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) { - tgt.addCareTeam(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) { - tgt.addAddresses(convertReferenceToCodableReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { - tgt.addActivity(convertCarePlanActivityComponent(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) { - tgt.addReplaces(convertReference(t)); - } - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) { - tgt.addPartOf(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - } - if (src.hasIntent()) { - tgt.setIntent(convertCarePlanIntent(src.getIntent())); - } - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) { - tgt.addCategory(convertCodeableConcept(t)); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasSubject()) { - tgt.setSubject(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - if (src.hasAuthor()) { - tgt.addAuthor(convertReference(src.getAuthor())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) { - tgt.addCareTeam(convertReference(t)); - } - for (CodeableReference t : src.getAddresses()) { - if (t.hasReference()) - tgt.addAddresses(convertReference(t.getReference())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) { - tgt.addSupportingInfo(convertReference(t)); - } - for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { - tgt.addActivity(convertCarePlanActivityComponent(t)); - } - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) { - tgt.addNote(convertAnnotation(t)); - } - - return tgt; - } - - public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); - - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { - tgt.addOutcome(convertCodeableConceptToCodableReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) { - tgt.addOutcome(convertReferenceToCodableReference(t)); - } - for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) { - tgt.addProgress(convertAnnotation(t)); - } - if (src.hasReference()) { - tgt.setReference(convertReference(src.getReference())); - } - if (src.hasDetail()) { - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); - - for (CodeableReference t : src.getOutcome()) { - if (t.hasConcept()) - tgt.addOutcomeCodeableConcept(convertCodeableConcept(t.getConcept())); - } - for (CodeableReference t : src.getOutcome()) { - if (t.hasReference()) - tgt.addOutcomeReference(convertReference(t.getReference())); - } - for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) { - tgt.addProgress(convertAnnotation(t)); - } - if (src.hasReference()) { - tgt.setReference(convertReference(src.getReference())); - } - if (src.hasDetail()) { - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - } - - return tgt; - } - - private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category"; - - public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - - if (src.hasCategory()) { - org.hl7.fhir.r5.model.Extension t = new org.hl7.fhir.r5.model.Extension(); - t.setUrl(CarePlanActivityDetailComponentExtension); - t.setValue(convertType(src.getCategory())); - tgt.addExtension(t); - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { - tgt.addReason(convertCodeableConceptToCodableReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { - tgt.addReason(convertReferenceToCodableReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); - } - if (src.hasStatusReason()) { - org.hl7.fhir.r5.model.Coding code = new org.hl7.fhir.r5.model.Coding(); - code.setCode(src.getStatusReason()); - org.hl7.fhir.r5.model.CodeableConcept t = new org.hl7.fhir.r5.model.CodeableConcept(code); - tgt.setStatusReason(t); - } - if (src.hasProhibited()) { - tgt.setDoNotPerform(src.getProhibited()); - } - if (src.hasScheduled()) { - tgt.setScheduled(convertType(src.getScheduled())); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) { - tgt.addPerformer(convertReference(t)); - } - if (src.hasProduct()) { - tgt.setProduct(convertType(src.getProduct())); - } - if (src.hasDailyAmount()) { - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - } - if (src.hasQuantity()) { - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - - if (src.hasExtension()) { - org.hl7.fhir.r5.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension); - if (extension != null) { - org.hl7.fhir.r5.model.DataType value = extension.getValue(); - if (value instanceof org.hl7.fhir.r5.model.CodeableConcept) { - tgt.setCategory(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) value)); + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) { + if (((org.hl7.fhir.r5.model.Parameters) src).hasParameter("profile-url")) + return ExpansionProfile30_50.convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src); + else + return Parameters30_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src); } - } - } - if (src.hasCode()) { - tgt.setCode(convertCodeableConcept(src.getCode())); - } - for (CodeableReference t : src.getReason()) { - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - } - for (CodeableReference t : src.getReason()) { - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) { - tgt.addGoal(convertReference(t)); - } - if (src.hasStatus()) { - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); - } - if (src.hasStatusReason()) { - List coding = src.getStatusReason().getCoding(); - if (coding.size() > 0) { - tgt.setStatusReason(coding.get(0).getCode()); - } - } - if (src.hasDoNotPerform()) { - tgt.setProhibited(src.getDoNotPerform()); - } - if (src.hasScheduled()) { - tgt.setScheduled(convertType(src.getScheduled())); - } - if (src.hasLocation()) { - tgt.setLocation(convertReference(src.getLocation())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) { - tgt.addPerformer(convertReference(t)); - } - if (src.hasProduct()) { - tgt.setProduct(convertType(src.getProduct())); - } - if (src.hasDailyAmount()) { - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - } - if (src.hasQuantity()) { - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - return tgt; - } - - private static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) { - if (src == null) - return null; - switch (src) { - case CANCELLED: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case INPROGRESS: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case NOTSTARTED: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case ONHOLD: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case SCHEDULED: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case UNKNOWN: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.UNKNOWN; - default: - return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) { - if (src == null) - return null; - switch (src) { - case CANCELLED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case INPROGRESS: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case NOTSTARTED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case ONHOLD: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case SCHEDULED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - private static org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; - case CANCELLED: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED; - case COMPLETED: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR; - case SUSPENDED: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD; - case UNKNOWN: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN; - default: - return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; - case REVOKED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; - case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; - case DRAFT: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ENTEREDINERROR; - case ONHOLD: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.SUSPENDED; - case UNKNOWN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.UNKNOWN; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; - } - } - - private static org.hl7.fhir.r5.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPTION: - return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.OPTION; - case ORDER: - return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.ORDER; - case PLAN: - return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PROPOSAL; - default: - return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPTION: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.OPTION; - case ORDER: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.ORDER; - case PLAN: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PLAN; - case PROPOSAL: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PROPOSAL; - default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.NULL; - } - } - public static org.hl7.fhir.r5.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CareTeam tgt = new org.hl7.fhir.r5.model.CareTeam(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertCareTeamStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertCareTeamParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) - tgt.addManagingOrganization(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertCareTeamStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertCareTeamParticipantComponent(t)); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) - tgt.addManagingOrganization(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.PROPOSED; - case ACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED; - case ACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasMember()) - tgt.setMember(convertReference(src.getMember())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - if (src.hasPeriod()) - tgt.setCoverage(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasMember()) - tgt.setMember(convertReference(src.getMember())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - if (src.hasCoveragePeriod()) - tgt.setPeriod(convertPeriod(src.getCoveragePeriod())); - return tgt; - } - -// public static org.hl7.fhir.r5.model.Claim convertClaim(org.hl7.fhir.dstu3.model.Claim src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim tgt = new org.hl7.fhir.r5.model.Claim(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertClaimStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasUse()) -// tgt.setUse(convertUse(src.getUse())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasBillablePeriod()) -// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); -// if (src.hasCreated()) -// tgt.setCreated(src.getCreated()); -// if (src.hasEnterer()) -// tgt.setEnterer(convertReference(src.getEnterer())); -// if (src.hasInsurer()) -// tgt.setInsurer(convertReference(src.getInsurer())); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -//// if (src.hasOrganization()) -//// tgt.addOrganization(convertReference(src.getOrganization())); -// if (src.hasPriority()) -// tgt.setPriority(convertCodeableConcept(src.getPriority())); -// if (src.hasFundsReserve()) -// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); -// for (org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent t : src.getRelated()) -// tgt.addRelated(convertRelatedClaimComponent(t)); -// if (src.hasPrescription()) -// tgt.setPrescription(convertReference(src.getPrescription())); -// if (src.hasOriginalPrescription()) -// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); -// if (src.hasPayee()) -// tgt.setPayee(convertPayeeComponent(src.getPayee())); -// if (src.hasReferral()) -// tgt.setReferral(convertReference(src.getReferral())); -// if (src.hasFacility()) -// tgt.setFacility(convertReference(src.getFacility())); -// for (org.hl7.fhir.dstu3.model.Claim.CareTeamComponent t : src.getCareTeam()) -// tgt.addCareTeam(convertCareTeamComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent t : src.getInformation()) -// tgt.addInformation(convertSpecialConditionComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent t : src.getDiagnosis()) -// tgt.addDiagnosis(convertDiagnosisComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.ProcedureComponent t : src.getProcedure()) -// tgt.addProcedure(convertProcedureComponent(t)); -// for (org.hl7.fhir.dstu3.model.Claim.InsuranceComponent t : src.getInsurance()) -// tgt.addInsurance(convertInsuranceComponent(t)); -// if (src.hasAccident()) -// tgt.setAccident(convertAccidentComponent(src.getAccident())); -//// if (src.hasEmploymentImpacted()) -//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); -//// if (src.hasHospitalization()) -//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); -// for (org.hl7.fhir.dstu3.model.Claim.ItemComponent t : src.getItem()) -// tgt.addItem(convertItemComponent(t)); -// if (src.hasTotal()) -// tgt.setTotal(convertMoney(src.getTotal())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim convertClaim(org.hl7.fhir.r5.model.Claim src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim tgt = new org.hl7.fhir.dstu3.model.Claim(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertClaimStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasUse()) -// tgt.setUse(convertUse(src.getUse())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasBillablePeriod()) -// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); -// if (src.hasCreated()) -// tgt.setCreated(src.getCreated()); -// if (src.hasEnterer()) -// tgt.setEnterer(convertReference(src.getEnterer())); -// if (src.hasInsurer()) -// tgt.setInsurer(convertReference(src.getInsurer())); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -//// if (src.hasOrganization()) -//// tgt.setOrganization(convertReference(src.getOrganization())); -// if (src.hasPriority()) -// tgt.setPriority(convertCodeableConcept(src.getPriority())); -// if (src.hasFundsReserve()) -// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); -// for (org.hl7.fhir.r5.model.Claim.RelatedClaimComponent t : src.getRelated()) -// tgt.addRelated(convertRelatedClaimComponent(t)); -// if (src.hasPrescription()) -// tgt.setPrescription(convertReference(src.getPrescription())); -// if (src.hasOriginalPrescription()) -// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); -// if (src.hasPayee()) -// tgt.setPayee(convertPayeeComponent(src.getPayee())); -// if (src.hasReferral()) -// tgt.setReferral(convertReference(src.getReferral())); -// if (src.hasFacility()) -// tgt.setFacility(convertReference(src.getFacility())); -// for (org.hl7.fhir.r5.model.Claim.CareTeamComponent t : src.getCareTeam()) -// tgt.addCareTeam(convertCareTeamComponent(t)); -// for (org.hl7.fhir.r5.model.Claim.SpecialConditionComponent t : src.getInformation()) -// tgt.addInformation(convertSpecialConditionComponent(t)); -// for (org.hl7.fhir.r5.model.Claim.DiagnosisComponent t : src.getDiagnosis()) -// tgt.addDiagnosis(convertDiagnosisComponent(t)); -// for (org.hl7.fhir.r5.model.Claim.ProcedureComponent t : src.getProcedure()) -// tgt.addProcedure(convertProcedureComponent(t)); -// for (org.hl7.fhir.r5.model.Claim.InsuranceComponent t : src.getInsurance()) -// tgt.addInsurance(convertInsuranceComponent(t)); -// if (src.hasAccident()) -// tgt.setAccident(convertAccidentComponent(src.getAccident())); -//// if (src.hasEmploymentImpacted()) -//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); -//// if (src.hasHospitalization()) -//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); -// for (org.hl7.fhir.r5.model.Claim.ItemComponent t : src.getItem()) -// tgt.addItem(convertItemComponent(t)); -// if (src.hasTotal()) -// tgt.setTotal(convertMoney(src.getTotal())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.dstu3.model.Claim.ClaimStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r5.model.Claim.ClaimStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r5.model.Claim.ClaimStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.Claim.ClaimStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.r5.model.Claim.ClaimStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.r5.model.Claim.Use convertUse(org.hl7.fhir.dstu3.model.Claim.Use src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPLETE: return org.hl7.fhir.r5.model.Claim.Use.CLAIM; -// case PROPOSED: return org.hl7.fhir.r5.model.Claim.Use.PREAUTHORIZATION; -// case EXPLORATORY: return org.hl7.fhir.r5.model.Claim.Use.PREDETERMINATION; -// default: return org.hl7.fhir.r5.model.Claim.Use.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Claim.Use convertUse(org.hl7.fhir.r5.model.Claim.Use src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case CLAIM: return org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE; -// case PREAUTHORIZATION: return org.hl7.fhir.dstu3.model.Claim.Use.PROPOSED; -// case PREDETERMINATION: return org.hl7.fhir.dstu3.model.Claim.Use.EXPLORATORY; -// default: return org.hl7.fhir.dstu3.model.Claim.Use.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.Claim.RelatedClaimComponent(); -// copyElement(src, tgt); -// if (src.hasClaim()) -// tgt.setClaim(convertReference(src.getClaim())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasReference()) -// tgt.setReference(convertIdentifier(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.Claim.RelatedClaimComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent(); -// copyElement(src, tgt); -// if (src.hasClaim()) -// tgt.setClaim(convertReference(src.getClaim())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasReference()) -// tgt.setReference(convertIdentifier(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.dstu3.model.Claim.PayeeComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r5.model.Claim.PayeeComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasResourceType()) -// tgt.setResource(convertCoding(src.getResourceType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.Claim.PayeeComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.PayeeComponent tgt = new org.hl7.fhir.dstu3.model.Claim.PayeeComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasResource()) -// tgt.setResourceType(convertCoding(src.getResource())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.dstu3.model.Claim.CareTeamComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r5.model.Claim.CareTeamComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasResponsible()) -// tgt.setResponsible(src.getResponsible()); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasQualification()) -// tgt.setQualification(convertCodeableConcept(src.getQualification())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.Claim.CareTeamComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.dstu3.model.Claim.CareTeamComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasProvider()) -// tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasResponsible()) -// tgt.setResponsible(src.getResponsible()); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasQualification()) -// tgt.setQualification(convertCodeableConcept(src.getQualification())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.r5.model.Claim.SpecialConditionComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// if (src.hasTiming()) -// tgt.setTiming(convertType(src.getTiming())); -// if (src.hasValue()) -// tgt.setValue(convertType(src.getValue())); -// if (src.hasReason()) -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.r5.model.Claim.SpecialConditionComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); -// if (src.hasTiming()) -// tgt.setTiming(convertType(src.getTiming())); -// if (src.hasValue()) -// tgt.setValue(convertType(src.getValue())); -// if (src.hasReason()) -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Claim.DiagnosisComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDiagnosis()) -// tgt.setDiagnosis(convertType(src.getDiagnosis())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// if (src.hasPackageCode()) -// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Claim.DiagnosisComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDiagnosis()) -// tgt.setDiagnosis(convertType(src.getDiagnosis())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// if (src.hasPackageCode()) -// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.dstu3.model.Claim.ProcedureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r5.model.Claim.ProcedureComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasProcedure()) -// tgt.setProcedure(convertType(src.getProcedure())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.Claim.ProcedureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ProcedureComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasProcedure()) -// tgt.setProcedure(convertType(src.getProcedure())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.dstu3.model.Claim.InsuranceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r5.model.Claim.InsuranceComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasFocal()) -// tgt.setFocal(src.getFocal()); -// if (src.hasCoverage()) -// tgt.setCoverage(convertReference(src.getCoverage())); -// if (src.hasBusinessArrangement()) -// tgt.setBusinessArrangement(src.getBusinessArrangement()); -// for (org.hl7.fhir.dstu3.model.StringType t : src.getPreAuthRef()) -// tgt.addPreAuthRef(t.getValue()); -// if (src.hasClaimResponse()) -// tgt.setClaimResponse(convertReference(src.getClaimResponse())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.Claim.InsuranceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.dstu3.model.Claim.InsuranceComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasFocal()) -// tgt.setFocal(src.getFocal()); -// if (src.hasCoverage()) -// tgt.setCoverage(convertReference(src.getCoverage())); -// if (src.hasBusinessArrangement()) -// tgt.setBusinessArrangement(src.getBusinessArrangement()); -// for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) -// tgt.addPreAuthRef(t.getValue()); -// if (src.hasClaimResponse()) -// tgt.setClaimResponse(convertReference(src.getClaimResponse())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.dstu3.model.Claim.AccidentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r5.model.Claim.AccidentComponent(); -// copyElement(src, tgt); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.Claim.AccidentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.AccidentComponent tgt = new org.hl7.fhir.dstu3.model.Claim.AccidentComponent(); -// copyElement(src, tgt); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.dstu3.model.Claim.ItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.ItemComponent tgt = new org.hl7.fhir.r5.model.Claim.ItemComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getCareTeamLinkId()) -// tgt.addCareTeamSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getDiagnosisLinkId()) -// tgt.addDiagnosisSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getProcedureLinkId()) -// tgt.addProcedureSequence(t.getValue()); -// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getInformationLinkId()) -// tgt.addInformationSequence(t.getValue()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasServiced()) -// tgt.setServiced(convertType(src.getServiced())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// if (src.hasBodySite()) -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubSite()) -// tgt.addSubSite(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getEncounter()) -// tgt.addEncounter(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Claim.DetailComponent t : src.getDetail()) -// tgt.addDetail(convertDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.Claim.ItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.ItemComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ItemComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence()) -// tgt.addCareTeamLinkId(t.getValue()); -// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence()) -// tgt.addDiagnosisLinkId(t.getValue()); -// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence()) -// tgt.addProcedureLinkId(t.getValue()); -// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence()) -// tgt.addInformationLinkId(t.getValue()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasServiced()) -// tgt.setServiced(convertType(src.getServiced())); -// if (src.hasLocation()) -// tgt.setLocation(convertType(src.getLocation())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// if (src.hasBodySite()) -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) -// tgt.addSubSite(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) -// tgt.addEncounter(convertReference(t)); -// for (org.hl7.fhir.r5.model.Claim.DetailComponent t : src.getDetail()) -// tgt.addDetail(convertDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.dstu3.model.Claim.DetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.DetailComponent tgt = new org.hl7.fhir.r5.model.Claim.DetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Claim.SubDetailComponent t : src.getSubDetail()) -// tgt.addSubDetail(convertSubDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.Claim.DetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.DetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// for (org.hl7.fhir.r5.model.Claim.SubDetailComponent t : src.getSubDetail()) -// tgt.addSubDetail(convertSubDetailComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.dstu3.model.Claim.SubDetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r5.model.Claim.SubDetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.Claim.SubDetailComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SubDetailComponent(); -// copyElement(src, tgt); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasRevenue()) -// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); -// if (src.hasService()) -// tgt.setService(convertCodeableConcept(src.getService())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) -// tgt.addModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) -// tgt.addProgramCode(convertCodeableConcept(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) -// tgt.addUdi(convertReference(t)); -// return tgt; -// } -// - public static org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasAssessor()) - tgt.setPerformer(convertReference(src.getAssessor())); - if (src.hasPrevious()) - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProtocol()) - tgt.addProtocol(t.getValue()); - if (src.hasSummary()) - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPrognosisCodeableConcept()) - tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPrognosisReference()) - tgt.addPrognosisReference(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); -// if (src.hasCode()) -// tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPerformer()) - tgt.setAssessor(convertReference(src.getPerformer())); - if (src.hasPrevious()) - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getProtocol()) - tgt.addProtocol(t.getValue()); - if (src.hasSummary()) - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPrognosisCodeableConcept()) - tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPrognosisReference()) - tgt.addPrognosisReference(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getAction()) -// tgt.addAction(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.EventStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; - case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - tgt.setItem(convertCodeableConceptToCodableReference(src.getItemCodeableConcept())); - if (src.hasItemReference()) - tgt.setItem(convertReferenceToCodableReference(src.getItemReference())); - if (src.hasBasis()) - tgt.setBasis(src.getBasis()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItem() && src.getItem().hasConcept()) - tgt.setItem(convertType(src.getItem().getConcept())); - else if (src.hasItem() && src.getItem().hasReference()) - tgt.setItem(convertType(src.getItem().getReference())); - if (src.hasBasis()) - tgt.setBasis(src.getBasis()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasHierarchyMeaning()) - tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - if (src.hasContent()) - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasHierarchyMeaning()) - tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - if (src.hasContent()) - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUPEDBY: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; - case ISA: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; - case PARTOF: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; - case CLASSIFIEDWITH: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; - default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUPEDBY: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; - case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; - case PARTOF: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; - case CLASSIFIEDWITH: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; - } -} - - private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getOperator()) - copyElement(t, tgt.addOperatorElement().setValue(convertFilterOperator(t.getValue()))); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getOperator()) - copyElement(t, tgt.addOperatorElement().setValue(convertFilterOperator(t.getValue()))); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS; - default: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS; - default: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL; - } -} - - public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiatesCanonical(t.getReference()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasNotDone()) - tgt.setStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE); - else if (src.hasStatus()) - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - if (src.hasNotDoneReason()) - tgt.setStatusReason(convertCodeableConcept(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasSent()) - tgt.setSent(src.getSent()); - if (src.hasReceived()) - tgt.setReceived(src.getReceived()); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) - tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - if (src.getStatus() == org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE) - tgt.setNotDone(true); - else - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - if (src.hasStatusReason()) - tgt.setNotDoneReason(convertCodeableConcept(src.getStatusReason())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasSent()) - tgt.setSent(src.getSent()); - if (src.hasReceived()) - tgt.setReceived(src.getReceived()); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.EventStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: return org.hl7.fhir.r5.model.Enumerations.EventStatus.PREPARATION; - case INPROGRESS: return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; - case SUSPENDED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.ONHOLD; - case ABORTED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.STOPPED; - case COMPLETED: return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.EventStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PREPARATION: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.PREPARATION; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - if (src.hasContent()) - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - if (src.hasContent()) - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCompartmentType(src.getCode())); - if (src.hasSearch()) - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCompartmentType(src.getCode())); - if (src.hasSearch()) - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; - default: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r5.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasClass_()) - tgt.addCategory(convertCodeableConcept(src.getClass_())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasConfidentiality()) - tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); - for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasConfidentiality()) - tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); - for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); - for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case U: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.U; - case L: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.L; - case M: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.M; - case N: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.N; - case R: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.R; - case V: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.V; - default: return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case U: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U; - case L: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L; - case M: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M; - case N: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N; - case R: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R; - case V: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V; - default: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL; - } -} - - public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - if (src.hasParty()) - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.addMode(convertCompositionAttestationMode(src.getMode())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - if (src.hasParty()) - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); - copyElement(src, tgt); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - if (src.hasMode()) - tgt.setMode(convertSectionMode(src.getMode())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); - copyElement(src, tgt); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - if (src.hasMode()) - tgt.setMode(convertSectionMode(src.getMode())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ListMode convertSectionMode(org.hl7.fhir.dstu3.model.Composition.SectionMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; - default: return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasSource()) { - org.hl7.fhir.r5.model.DataType t = convertType(src.getSource()); - tgt.setSource(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); - } - if (src.hasTarget()) { - org.hl7.fhir.r5.model.DataType t = convertType(src.getTarget()); - tgt.setTarget(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); - } - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertConceptMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasSource()) - tgt.setSource(convertType(src.getSource())); - if (src.hasTarget()) - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertConceptMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setSource(src.getSource()); - if (src.hasSourceVersion()) - tgt.setSourceVersion(src.getSourceVersion()); - if (src.hasTarget()) - tgt.setTarget(src.getTarget()); - if (src.hasTargetVersion()) - tgt.setTargetVersion(src.getTargetVersion()); - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) - tgt.addElement(convertSourceElementComponent(t)); - if (src.hasUnmapped()) - tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setSource(src.getSource()); - if (src.hasSourceVersion()) - tgt.setSourceVersion(src.getSourceVersion()); - if (src.hasTarget()) - tgt.setTarget(src.getTarget()); - if (src.hasTargetVersion()) - tgt.setTargetVersion(src.getTargetVersion()); - for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) - tgt.addElement(convertSourceElementComponent(t)); - if (src.hasUnmapped()) - tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - if (t.getEquivalence() == org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { - tgt.setNoMap(true); - } else { - tgt.addTarget(convertTargetElementComponent(t)); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasNoMap() && src.getNoMap() == true) { - tgt.addTarget(new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); - } - else { - for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t)); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasEquivalence()) - tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasRelationship()) - tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RELATEDTO: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; - case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; - case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; - case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; - case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; - case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; - default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RELATEDTO: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.RELATEDTO; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case BROADER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case NOTRELATEDTO: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } -} - - public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setValue(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setCode(src.getValue()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); - copyElement(src, tgt); - if (src.hasMode()) - tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVIDED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; - case FIXED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; - case OTHERMAP: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; - default: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVIDED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; - case FIXED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; - case OTHERMAP: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; - default: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasSeverity()) - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAbatement()) - tgt.setAbatement(convertType(src.getAbatement())); - if (src.hasAssertedDate()) - tgt.setRecordedDate(src.getAssertedDate()); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasStage()) - tgt.addStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasClinicalStatus()) - tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); - if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasSeverity()) - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - if (src.hasAbatement()) - tgt.setAbatement(convertType(src.getAbatement())); - if (src.hasRecordedDate()) - tgt.setAssertedDate(src.getRecordedDate()); - if (src.hasAsserter()) - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasStage()) - tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); - for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static final String CODE_SYSTEM_CONDITION_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-clinical"; - private static final String CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL = "http://hl7.org/fhir/condition-clinical"; - - private static org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); - switch (src) { - case ACTIVE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("active"); - return cc; - case RECURRENCE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("recurrence"); - return cc; - case INACTIVE: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("inactive"); - return cc; - case REMISSION: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("remission"); - return cc; - case RESOLVED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("resolved"); - return cc; - default: return null; - } - } - - private static org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "active") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "active")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.ACTIVE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "recurrence") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "recurrence")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RECURRENCE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "inactive") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "inactive")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.INACTIVE; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "remission") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "remission")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.REMISSION; - if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "resolved") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "resolved")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RESOLVED; - return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.NULL; - } - - private static final String CODE_SYSTEM_CONDITION_VER_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-ver-status"; - private static final String CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL = "http://hl7.org/fhir/condition-ver-status"; - - private static org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); - switch (src) { - case PROVISIONAL: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("provisional"); - return cc; - case DIFFERENTIAL: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("differential"); - return cc; - case CONFIRMED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("confirmed"); - return cc; - case REFUTED: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("refuted"); - return cc; - case ENTEREDINERROR: - cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("entered-in-error"); - return cc; - default: return null; - } - } - - private static org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { - if (src == null) - return null; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "provisional") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "provisional")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "differential") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "differential")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "confirmed") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "confirmed")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "refuted") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "refuted")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; - if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "entered-in-error") - ||src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "entered-in-error")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; - } - - public static org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - if (src.hasSummary()) - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - if (src.hasSummary()) - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Consent tgt = new org.hl7.fhir.r5.model.Consent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertConsentState(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) -// tgt.addCategory(convertCodeableConcept(t)); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// if (src.hasDateTime()) -// tgt.setDateTime(src.getDateTime()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getConsentingParty()) -// tgt.addConsentingParty(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent t : src.getActor()) -// tgt.addActor(convertConsentActorComponent(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getOrganization()) -// tgt.addOrganization(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(convertType(src.getSource())); -// for (org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent t : src.getPolicy()) -// tgt.addPolicy(convertConsentPolicyComponent(t)); -// if (src.hasPolicyRule()) -// tgt.setPolicyRule(src.getPolicyRule()); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) -// tgt.addSecurityLabel(convertCoding(t)); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) -// tgt.addPurpose(convertCoding(t)); -// if (src.hasDataPeriod()) -// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); -// for (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent t : src.getData()) -// tgt.addData(convertConsentDataComponent(t)); -// for (org.hl7.fhir.dstu3.model.Consent.ExceptComponent t : src.getExcept()) -// tgt.addExcept(convertExceptComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r5.model.Consent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertConsentState(src.getStatus())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) -// tgt.addCategory(convertCodeableConcept(t)); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// if (src.hasDateTime()) -// tgt.setDateTime(src.getDateTime()); -// for (org.hl7.fhir.r5.model.Reference t : src.getConsentingParty()) -// tgt.addConsentingParty(convertReference(t)); -// for (org.hl7.fhir.r5.model.Consent.ConsentActorComponent t : src.getActor()) -// tgt.addActor(convertConsentActorComponent(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getOrganization()) -// tgt.addOrganization(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(convertType(src.getSource())); -// for (org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent t : src.getPolicy()) -// tgt.addPolicy(convertConsentPolicyComponent(t)); -// if (src.hasPolicyRule()) -// tgt.setPolicyRule(src.getPolicyRule()); -// for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) -// tgt.addSecurityLabel(convertCoding(t)); -// for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) -// tgt.addPurpose(convertCoding(t)); -// if (src.hasDataPeriod()) -// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); -// for (org.hl7.fhir.r5.model.Consent.ConsentDataComponent t : src.getData()) -// tgt.addData(convertConsentDataComponent(t)); -// for (org.hl7.fhir.r5.model.Consent.ExceptComponent t : src.getExcept()) -// tgt.addExcept(convertExceptComponent(t)); - return tgt; - } -// -// private static org.hl7.fhir.r5.model.Consent.ConsentState convertConsentState(org.hl7.fhir.dstu3.model.Consent.ConsentState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DRAFT: return org.hl7.fhir.r5.model.Consent.ConsentState.DRAFT; -// case PROPOSED: return org.hl7.fhir.r5.model.Consent.ConsentState.PROPOSED; -// case ACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.ACTIVE; -// case REJECTED: return org.hl7.fhir.r5.model.Consent.ConsentState.REJECTED; -// case INACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Consent.ConsentState.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.Consent.ConsentState.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r5.model.Consent.ConsentState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DRAFT: return org.hl7.fhir.dstu3.model.Consent.ConsentState.DRAFT; -// case PROPOSED: return org.hl7.fhir.dstu3.model.Consent.ConsentState.PROPOSED; -// case ACTIVE: return org.hl7.fhir.dstu3.model.Consent.ConsentState.ACTIVE; -// case REJECTED: return org.hl7.fhir.dstu3.model.Consent.ConsentState.REJECTED; -// case INACTIVE: return org.hl7.fhir.dstu3.model.Consent.ConsentState.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Consent.ConsentState.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.Consent.ConsentState.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentActorComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.r5.model.Consent.ConsentActorComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent(); - copyElement(src, tgt); - if (src.hasAuthority()) - tgt.setAuthority(src.getAuthority()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent(); - copyElement(src, tgt); - if (src.hasAuthority()) - tgt.setAuthority(src.getAuthority()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - return tgt; - } -// -// public static org.hl7.fhir.r5.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentDataComponent(); -// copyElement(src, tgt); -// if (src.hasMeaning()) -// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.r5.model.Consent.ConsentDataComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent(); -// copyElement(src, tgt); -// if (src.hasMeaning()) -// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } - - private static org.hl7.fhir.r5.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.INSTANCE; - case RELATED: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.RELATED; - case DEPENDENTS: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.DEPENDENTS; - case AUTHOREDBY: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.AUTHOREDBY; - default: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r5.model.Consent.ConsentDataMeaning src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE; - case RELATED: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED; - case DEPENDENTS: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS; - case AUTHOREDBY: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY; - default: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL; - } -} - -// public static org.hl7.fhir.r5.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.dstu3.model.Consent.ExceptComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Consent.ExceptComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertConsentExceptType(src.getType())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent t : src.getActor()) -// tgt.addActor(convertExceptActorComponent(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) -// tgt.addSecurityLabel(convertCoding(t)); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) -// tgt.addPurpose(convertCoding(t)); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getClass_()) -// tgt.addClass_(convertCoding(t)); -// for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) -// tgt.addCode(convertCoding(t)); -// if (src.hasDataPeriod()) -// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); -// for (org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent t : src.getData()) -// tgt.addData(convertExceptDataComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.r5.model.Consent.ExceptComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Consent.ExceptComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertConsentExceptType(src.getType())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r5.model.Consent.ExceptActorComponent t : src.getActor()) -// tgt.addActor(convertExceptActorComponent(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) -// tgt.addSecurityLabel(convertCoding(t)); -// for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) -// tgt.addPurpose(convertCoding(t)); -// for (org.hl7.fhir.r5.model.Coding t : src.getClass_()) -// tgt.addClass_(convertCoding(t)); -// for (org.hl7.fhir.r5.model.Coding t : src.getCode()) -// tgt.addCode(convertCoding(t)); -// if (src.hasDataPeriod()) -// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); -// for (org.hl7.fhir.r5.model.Consent.ExceptDataComponent t : src.getData()) -// tgt.addData(convertExceptDataComponent(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DENY: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.DENY; -// case PERMIT: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.PERMIT; -// default: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.r5.model.Consent.ConsentExceptType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case DENY: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.DENY; -// case PERMIT: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.PERMIT; -// default: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptActorComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.r5.model.Consent.ExceptActorComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptDataComponent(); -// copyElement(src, tgt); -// if (src.hasMeaning()) -// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.r5.model.Consent.ExceptDataComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent(); -// copyElement(src, tgt); -// if (src.hasMeaning()) -// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); -// if (src.hasReference()) -// tgt.setReference(convertReference(src.getReference())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract tgt = new org.hl7.fhir.r5.model.Contract(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertContractStatus(src.getStatus())); -// if (src.hasIssued()) -// tgt.setIssued(src.getIssued()); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasContentDerivative()) -// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); -// for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) -// tgt.setRule(convertComputableLanguageComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.r5.model.Contract src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasStatus()) -// tgt.setStatus(convertContractStatus(src.getStatus())); -// if (src.hasIssued()) -// tgt.setIssued(src.getIssued()); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) -// tgt.addSubject(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthority()) -// tgt.addAuthority(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getDomain()) -// tgt.addDomain(convertReference(t)); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) -// tgt.addSubType(convertCodeableConcept(t)); -// if (src.hasContentDerivative()) -// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); -// for (org.hl7.fhir.r5.model.Contract.SignatoryComponent t : src.getSigner()) -// tgt.addSigner(convertSignatoryComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getTerm()) -// tgt.addTerm(convertTermComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) -// tgt.addFriendly(convertFriendlyLanguageComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.LegalLanguageComponent t : src.getLegal()) -// tgt.addLegal(convertLegalLanguageComponent(t)); -// if (src.hasRule()) -// tgt.addRule(convertComputableLanguageComponent(src.getRule())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.dstu3.model.Contract.ContractStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AMENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.AMENDED; -// case APPENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.APPENDED; -// case CANCELLED: return org.hl7.fhir.r5.model.Contract.ContractStatus.CANCELLED; -// case DISPUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.DISPUTED; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Contract.ContractStatus.ENTEREDINERROR; -// case EXECUTABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTABLE; -// case EXECUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTED; -// case NEGOTIABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.NEGOTIABLE; -// case OFFERED: return org.hl7.fhir.r5.model.Contract.ContractStatus.OFFERED; -// case POLICY: return org.hl7.fhir.r5.model.Contract.ContractStatus.POLICY; -// case REJECTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REJECTED; -// case RENEWED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RENEWED; -// case REVOKED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REVOKED; -// case RESOLVED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RESOLVED; -// case TERMINATED: return org.hl7.fhir.r5.model.Contract.ContractStatus.TERMINATED; -// default: return org.hl7.fhir.r5.model.Contract.ContractStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.r5.model.Contract.ContractStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case AMENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.AMENDED; -// case APPENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.APPENDED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.CANCELLED; -// case DISPUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.DISPUTED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.ENTEREDINERROR; -// case EXECUTABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTABLE; -// case EXECUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTED; -// case NEGOTIABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NEGOTIABLE; -// case OFFERED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.OFFERED; -// case POLICY: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.POLICY; -// case REJECTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REJECTED; -// case RENEWED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RENEWED; -// case REVOKED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REVOKED; -// case RESOLVED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RESOLVED; -// case TERMINATED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.TERMINATED; -// default: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r5.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCoding(src.getType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r5.model.Contract.SignatoryComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCoding(src.getType())); -// if (src.hasParty()) -// tgt.setParty(convertReference(src.getParty())); -// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) -// tgt.addSignature(convertSignature(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTime(src.getEffectiveTime()); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTime(src.getEffectiveTime()); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.TermComponent tgt = new org.hl7.fhir.r5.model.Contract.TermComponent(); -// copyElement(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasIssued()) -// tgt.setIssued(src.getIssued()); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubType()) -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r5.model.Contract.TermComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); -// copyElement(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasIssued()) -// tgt.setIssued(src.getIssued()); -// if (src.hasApplies()) -// tgt.setApplies(convertPeriod(src.getApplies())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubType()) -// tgt.setSubType(convertCodeableConcept(src.getSubType())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) -// tgt.addAction(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getActionReason()) -// tgt.addActionReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Contract.AgentComponent t : src.getAgent()) -// tgt.addAgent(convertTermAgentComponent(t)); -// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getGroup()) -// tgt.addGroup(convertTermComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); -// copyElement(src, tgt); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) -// tgt.addRole(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTime(src.getEffectiveTime()); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); -// copyElement(src, tgt); -// if (src.hasEntity()) -// tgt.setEntity(convertType(src.getEntity())); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasEffectiveTime()) -// tgt.setEffectiveTime(src.getEffectiveTime()); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasUnitPrice()) -// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); -// if (src.hasFactor()) -// tgt.setFactor(src.getFactor()); -// if (src.hasPoints()) -// tgt.setPoints(src.getPoints()); -// if (src.hasNet()) -// tgt.setNet(convertMoney(src.getNet())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r5.model.Contract.LegalLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); -// copyElement(src, tgt); -// if (src.hasContent()) -// tgt.setContent(convertType(src.getContent())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.Coverage convertCoverage(org.hl7.fhir.dstu3.model.Coverage src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Coverage tgt = new org.hl7.fhir.r5.model.Coverage(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertCoverageStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasPolicyHolder()) -// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); -// if (src.hasSubscriber()) -// tgt.setSubscriber(convertReference(src.getSubscriber())); -// if (src.hasSubscriberId()) -// tgt.setSubscriberId(src.getSubscriberId()); -// if (src.hasBeneficiary()) -// tgt.setBeneficiary(convertReference(src.getBeneficiary())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getPayor()) -// tgt.addPayor(convertReference(t)); -// if (src.hasGrouping()) -// tgt.setGrouping(convertGroupComponent(src.getGrouping())); -// if (src.hasDependent()) -// tgt.setDependent(src.getDependent()); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasOrder()) -// tgt.setOrder(src.getOrder()); -// if (src.hasNetwork()) -// tgt.setNetwork(src.getNetwork()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getContract()) -// tgt.addContract(convertReference(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Coverage convertCoverage(org.hl7.fhir.r5.model.Coverage src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Coverage tgt = new org.hl7.fhir.dstu3.model.Coverage(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertCoverageStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasPolicyHolder()) -// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); -// if (src.hasSubscriber()) -// tgt.setSubscriber(convertReference(src.getSubscriber())); -// if (src.hasSubscriberId()) -// tgt.setSubscriberId(src.getSubscriberId()); -// if (src.hasBeneficiary()) -// tgt.setBeneficiary(convertReference(src.getBeneficiary())); -// if (src.hasRelationship()) -// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasPeriod()) -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r5.model.Reference t : src.getPayor()) -// tgt.addPayor(convertReference(t)); -// if (src.hasGrouping()) -// tgt.setGrouping(convertGroupComponent(src.getGrouping())); -// if (src.hasDependent()) -// tgt.setDependent(src.getDependent()); -// if (src.hasSequence()) -// tgt.setSequence(src.getSequence()); -// if (src.hasOrder()) -// tgt.setOrder(src.getOrder()); -// if (src.hasNetwork()) -// tgt.setNetwork(src.getNetwork()); -// for (org.hl7.fhir.r5.model.Reference t : src.getContract()) -// tgt.addContract(convertReference(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.dstu3.model.Coverage.CoverageStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.r5.model.Coverage.CoverageStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.dstu3.model.Coverage.GroupComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Coverage.GroupComponent tgt = new org.hl7.fhir.r5.model.Coverage.GroupComponent(); -// copyElement(src, tgt); -// if (src.hasGroup()) -// tgt.setGroup(src.getGroup()); -// if (src.hasGroupDisplay()) -// tgt.setGroupDisplay(src.getGroupDisplay()); -// if (src.hasSubGroup()) -// tgt.setSubGroup(src.getSubGroup()); -// if (src.hasSubGroupDisplay()) -// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); -// if (src.hasPlan()) -// tgt.setPlan(src.getPlan()); -// if (src.hasPlanDisplay()) -// tgt.setPlanDisplay(src.getPlanDisplay()); -// if (src.hasSubPlan()) -// tgt.setSubPlan(src.getSubPlan()); -// if (src.hasSubPlanDisplay()) -// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); -// if (src.hasClass_()) -// tgt.setClass_(src.getClass_()); -// if (src.hasClassDisplay()) -// tgt.setClassDisplay(src.getClassDisplay()); -// if (src.hasSubClass()) -// tgt.setSubClass(src.getSubClass()); -// if (src.hasSubClassDisplay()) -// tgt.setSubClassDisplay(src.getSubClassDisplay()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.r5.model.Coverage.GroupComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Coverage.GroupComponent tgt = new org.hl7.fhir.dstu3.model.Coverage.GroupComponent(); -// copyElement(src, tgt); -// if (src.hasGroup()) -// tgt.setGroup(src.getGroup()); -// if (src.hasGroupDisplay()) -// tgt.setGroupDisplay(src.getGroupDisplay()); -// if (src.hasSubGroup()) -// tgt.setSubGroup(src.getSubGroup()); -// if (src.hasSubGroupDisplay()) -// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); -// if (src.hasPlan()) -// tgt.setPlan(src.getPlan()); -// if (src.hasPlanDisplay()) -// tgt.setPlanDisplay(src.getPlanDisplay()); -// if (src.hasSubPlan()) -// tgt.setSubPlan(src.getSubPlan()); -// if (src.hasSubPlanDisplay()) -// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); -// if (src.hasClass_()) -// tgt.setClass_(src.getClass_()); -// if (src.hasClassDisplay()) -// tgt.setClassDisplay(src.getClassDisplay()); -// if (src.hasSubClass()) -// tgt.setSubClass(src.getSubClass()); -// if (src.hasSubClassDisplay()) -// tgt.setSubClassDisplay(src.getSubClassDisplay()); -// return tgt; -// } -// - public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); -// if (src.hasStringency()) -// tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.getSnapshot().addElement(convertElementDefinition(t)); - tgt.setKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); - tgt.setAbstract(false); - tgt.setType(tgt.getName()); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); - tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - return tgt; - } - -// public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); -// copyDomainResource(src, tgt); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasStatus()) -// tgt.setStatus(convertPublicationStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// if (src.hasPublisher()) -// tgt.setPublisher(src.getPublisher()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasTitle()) -// tgt.setTitle(src.getTitle()); -// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertContactDetail(t)); -// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) -// tgt.addUseContext(convertUsageContext(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addJurisdiction(convertCodeableConcept(t)); -// if (src.hasCopyright()) -// tgt.setCopyright(src.getCopyright()); -// if (src.hasStringency()) -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } - -// private static org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; -// } -//} - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - -// public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// if (src.hasIdentity()) -// tgt.setIdentity(src.getIdentity()); -// if (src.hasUri()) -// tgt.setUri(src.getUri()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasComment()) -// tgt.setComment(src.getComment()); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCode(convertCodeableConcept(src.getCategory())); - if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setIdentified(convertDateTime(src.getDateElement())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - if (src.hasReference()) - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasStatus()) - tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); - if (src.hasCode()) - tgt.setCategory(convertCodeableConcept(src.getCode())); - if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasIdentifiedDateTimeType()) - tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - if (src.hasReference()) - tgt.setReference(src.getReference()); - for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; - } -} - - public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - if (src.hasAction()) - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - if (src.hasAction()) - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - -// public static org.hl7.fhir.r5.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Device tgt = new org.hl7.fhir.r5.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); -// if (src.hasStatus()) -// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLotNumber()) -// tgt.setLotNumber(src.getLotNumber()); -// if (src.hasManufacturer()) -// tgt.setManufacturer(src.getManufacturer()); -// if (src.hasManufactureDate()) -// tgt.setManufactureDate(src.getManufactureDate()); -// if (src.hasExpirationDate()) -// tgt.setExpirationDate(src.getExpirationDate()); -// if (src.hasModel()) -// tgt.setModel(src.getModel()); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasOwner()) -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasLocation()) -// tgt.setLocation(convertReference(src.getLocation())); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSafety()) -// tgt.addSafety(convertCodeableConcept(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.r5.model.Device src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasUdi()) -// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); -// if (src.hasStatus()) -// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLotNumber()) -// tgt.setLotNumber(src.getLotNumber()); -// if (src.hasManufacturer()) -// tgt.setManufacturer(src.getManufacturer()); -// if (src.hasManufactureDate()) -// tgt.setManufactureDate(src.getManufactureDate()); -// if (src.hasExpirationDate()) -// tgt.setExpirationDate(src.getExpirationDate()); -// if (src.hasModel()) -// tgt.setModel(src.getModel()); -// if (src.hasVersion()) -// tgt.setVersion(src.getVersion()); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasOwner()) -// tgt.setOwner(convertReference(src.getOwner())); -// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasLocation()) -// tgt.setLocation(convertReference(src.getLocation())); -// if (src.hasUrl()) -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety()) -// tgt.addSafety(convertCodeableConcept(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ACTIVE; -// case INACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// case UNKNOWN: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.UNKNOWN; -// default: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.r5.model.Device.FHIRDeviceStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; -// case INACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; -// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.UNKNOWN; -// default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceUdiComponent(); -// copyElement(src, tgt); -// if (src.hasDeviceIdentifier()) -// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasJurisdiction()) -// tgt.setJurisdiction(src.getJurisdiction()); -// if (src.hasCarrierHRF()) -// tgt.setCarrierHRF(src.getCarrierHRF()); -// if (src.hasCarrierAIDC()) -// tgt.setCarrierAIDC(src.getCarrierAIDC()); -// if (src.hasIssuer()) -// tgt.setIssuer(src.getIssuer()); -// if (src.hasEntryType()) -// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.r5.model.Device.DeviceUdiComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent(); -// copyElement(src, tgt); -// if (src.hasDeviceIdentifier()) -// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); -// if (src.hasName()) -// tgt.setName(src.getName()); -// if (src.hasJurisdiction()) -// tgt.setJurisdiction(src.getJurisdiction()); -// if (src.hasCarrierHRF()) -// tgt.setCarrierHRF(src.getCarrierHRF()); -// if (src.hasCarrierAIDC()) -// tgt.setCarrierAIDC(src.getCarrierAIDC()); -// if (src.hasIssuer()) -// tgt.setIssuer(src.getIssuer()); -// if (src.hasEntryType()) -// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.dstu3.model.Device.UDIEntryType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BARCODE: return org.hl7.fhir.r5.model.Device.UDIEntryType.BARCODE; -// case RFID: return org.hl7.fhir.r5.model.Device.UDIEntryType.RFID; -// case MANUAL: return org.hl7.fhir.r5.model.Device.UDIEntryType.MANUAL; -// case CARD: return org.hl7.fhir.r5.model.Device.UDIEntryType.CARD; -// case SELFREPORTED: return org.hl7.fhir.r5.model.Device.UDIEntryType.SELFREPORTED; -// case UNKNOWN: return org.hl7.fhir.r5.model.Device.UDIEntryType.UNKNOWN; -// default: return org.hl7.fhir.r5.model.Device.UDIEntryType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.r5.model.Device.UDIEntryType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BARCODE: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.BARCODE; -// case RFID: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.RFID; -// case MANUAL: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.MANUAL; -// case CARD: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.CARD; -// case SELFREPORTED: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.SELFREPORTED; -// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.UNKNOWN; -// default: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DeviceComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLastSystemChange()) -// tgt.setLastSystemChange(src.getLastSystemChange()); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// if (src.hasParameterGroup()) -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// if (src.hasMeasurementPrinciple()) -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// if (src.hasLanguageCode()) -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r5.model.DeviceComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasLastSystemChange()) -// tgt.setLastSystemChange(src.getLastSystemChange()); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOperationalStatus()) -// tgt.addOperationalStatus(convertCodeableConcept(t)); -// if (src.hasParameterGroup()) -// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); -// if (src.hasMeasurementPrinciple()) -// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); -// for (org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) -// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); -// if (src.hasLanguageCode()) -// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; -// case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; -// case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; -// case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; -// case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; -// case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; -// case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; -// case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; -// case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; -// case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; -// case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; -// default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// if (src.hasSpecType()) -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// if (src.hasComponentId()) -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// if (src.hasProductionSpec()) -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); -// copyElement(src, tgt); -// if (src.hasSpecType()) -// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); -// if (src.hasComponentId()) -// tgt.setComponentId(convertIdentifier(src.getComponentId())); -// if (src.hasProductionSpec()) -// tgt.setProductionSpec(src.getProductionSpec()); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasUnit()) -// tgt.setUnit(convertCodeableConcept(src.getUnit())); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// if (src.hasOperationalStatus()) -// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); -// if (src.hasColor()) -// tgt.setColor(convertDeviceMetricColor(src.getColor())); -// if (src.hasCategory()) -// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); -// if (src.hasMeasurementPeriod()) -// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); -// for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) -// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); -// copyDomainResource(src, tgt); -// if (src.hasIdentifier()) -// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasUnit()) -// tgt.setUnit(convertCodeableConcept(src.getUnit())); -// if (src.hasSource()) -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasParent()) -// tgt.setParent(convertReference(src.getParent())); -// if (src.hasOperationalStatus()) -// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); -// if (src.hasColor()) -// tgt.setColor(convertDeviceMetricColor(src.getColor())); -// if (src.hasCategory()) -// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); -// if (src.hasMeasurementPeriod()) -// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); -// for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) -// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ON: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; -// case OFF: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; -// case STANDBY: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; -// case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; -// case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BLACK: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; -// case RED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; -// case GREEN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; -// case YELLOW: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; -// case BLUE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; -// case MAGENTA: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; -// case CYAN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; -// case WHITE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; -// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; -// case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; -// case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; -// case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; -// case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; -// case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; -// case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; -// case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; -// } -//} -// -// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case MEASUREMENT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; -// case SETTING: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; -// case CALCULATION: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; -// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; -// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; -// case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; -// case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); -// if (src.hasState()) -// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); -// if (src.hasTime()) -// tgt.setTime(src.getTime()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); -// if (src.hasState()) -// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); -// if (src.hasTime()) -// tgt.setTime(src.getTime()); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; -// case OFFSET: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; -// case GAIN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; -// case TWOPOINT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; -// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; -// case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; -// case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; -// case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; -// } -//} -// -// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NOTCALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; -// case CALIBRATIONREQUIRED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; -// case CALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; -// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; -// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; -// case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; -// case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; -// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; -// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; -// } -//} -// - - public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasRecordedOn()) - tgt.setRecordedOn(src.getRecordedOn()); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - if (src.hasRecordedOn()) - tgt.setRecordedOn(src.getRecordedOn()); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addIndication(convertCodeableConcept(t.getConcept())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; - default: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; - default: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); -// for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) -// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addMedia(convertDiagnosticReportImageComponent(t)); - if (src.hasConclusion()) - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addConclusionCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); -// for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) -// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - if (src.hasConclusion()) - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case PRELIMINARY: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } -} - -// public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent(); -// copyElement(src, tgt); -// if (src.hasRole()) -// tgt.setRole(convertCodeableConcept(src.getRole())); -// if (src.hasActor()) -// tgt.setActor(convertReference(src.getActor())); -// return tgt; -// } -// - public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); - copyElement(src, tgt); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasLink()) - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasLink()) - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - -// public static org.hl7.fhir.r5.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DocumentManifest tgt = new org.hl7.fhir.r5.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// if (src.hasMasterIdentifier()) -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); -// if (src.hasCreated()) -// tgt.setCreated(src.getCreated()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) -// tgt.addAgent().setWho(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(src.getSource()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r5.model.DocumentManifest src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); -// copyDomainResource(src, tgt); -// if (src.hasMasterIdentifier()) -// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); -// if (src.hasCreated()) -// tgt.setCreated(src.getCreated()); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) -// tgt.addRecipient(convertReference(t)); -// if (src.hasSource()) -// tgt.setSource(src.getSource()); -// if (src.hasDescription()) -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) -// tgt.addContent(convertDocumentManifestContentComponent(t)); -// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) -// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); -// return tgt; -// } - - private static org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; - } -} -// -// public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// if (src.hasP()) -// tgt.setP(convertType(src.getP())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); -// copyElement(src, tgt); -// if (src.hasP()) -// tgt.setP(convertType(src.getP())); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasRef()) - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasRef()) - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public static org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); - copyDomainResource(src, tgt); - if (src.hasMasterIdentifier()) - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - if (src.hasDocStatus()) - tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasClass_()) - tgt.addCategory(convertCodeableConcept(src.getClass_())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasCreated()) - tgt.setDate(src.getCreated()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - if (src.hasAuthenticator()) - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - if (src.hasContext()) - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); - copyDomainResource(src, tgt); - if (src.hasMasterIdentifier()) - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - if (src.hasDocStatus()) - tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCategory()) - tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasDate()) - tgt.setCreated(src.getDate()); -// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) -// tgt.addAuthor(convertReference(t)); - if (src.hasAuthenticator()) - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - if (src.hasCustodian()) - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - if (src.hasContext()) - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType2(src.getCode())); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType2(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; - } -} - - - public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - if (src.hasAttachment()) - tgt.setAttachment(convertAttachment(src.getAttachment())); - if (src.hasFormat()) - tgt.setFormat(convertCoding(src.getFormat())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - if (src.hasAttachment()) - tgt.setAttachment(convertAttachment(src.getAttachment())); - if (src.hasFormat()) - tgt.setFormat(convertCoding(src.getFormat())); - return tgt; - } - - public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.addEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasFacilityType()) - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - if (src.hasPracticeSetting()) - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - if (src.hasSourcePatientInfo()) - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounterFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasFacilityType()) - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - if (src.hasPracticeSetting()) - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - if (src.hasSourcePatientInfo()) - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Reference tgt = convertReference(src.getRef()); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertStatusHistoryComponent(t)); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) - tgt.addClassHistory(convertClassHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - if (src.hasAppointment()) - tgt.addAppointment(convertReference(src.getAppointment())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasLength()) - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - if (src.hasHospitalization()) - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - if (src.hasServiceProvider()) - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertStatusHistoryComponent(t)); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) - tgt.addClassHistory(convertClassHistoryComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - if (src.hasAppointment()) - tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasLength()) - tgt.setLength(convertDuration(src.getLength())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReason(convertCodeableConcept(t.getConcept())); - for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - if (src.hasHospitalization()) - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - if (src.hasServiceProvider()) - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case TRIAGED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case INPROGRESS: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; - case FINISHED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEncounterStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); - copyElement(src, tgt); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); - copyElement(src, tgt); - if (src.hasClass_()) - tgt.setClass_(convertCoding(src.getClass_())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIndividual()) - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIndividual()) - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setUse(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasUse()) - tgt.setRole(convertCodeableConcept(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - if (src.hasPreAdmissionIdentifier()) - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - if (src.hasOrigin()) - tgt.setOrigin(convertReference(src.getOrigin())); - if (src.hasAdmitSource()) - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - if (src.hasReAdmission()) - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - if (src.hasDischargeDisposition()) - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - if (src.hasPreAdmissionIdentifier()) - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - if (src.hasOrigin()) - tgt.setOrigin(convertReference(src.getOrigin())); - if (src.hasAdmitSource()) - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - if (src.hasReAdmission()) - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - if (src.hasDischargeDisposition()) - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Endpoint convertEndpoint(org.hl7.fhir.dstu3.model.Endpoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Endpoint tgt = new org.hl7.fhir.r5.model.Endpoint(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEndpointStatus(src.getStatus())); - if (src.hasConnectionType()) - tgt.setConnectionType(convertCoding(src.getConnectionType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPayloadType()) - tgt.addPayloadType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getPayloadMimeType()) - tgt.addPayloadMimeType(t.getValue()); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Endpoint convertEndpoint(org.hl7.fhir.r5.model.Endpoint src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Endpoint tgt = new org.hl7.fhir.dstu3.model.Endpoint(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEndpointStatus(src.getStatus())); - if (src.hasConnectionType()) - tgt.setConnectionType(convertCoding(src.getConnectionType())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPayloadType()) - tgt.addPayloadType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeType t : src.getPayloadMimeType()) - tgt.addPayloadMimeType(t.getValue()); - if (src.hasAddress()) - tgt.setAddress(src.getAddress()); - for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) - tgt.addHeader(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.SUSPENDED; - case ERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ERROR; - case OFF: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.OFF; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ENTEREDINERROR; - case TEST: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.TEST; - default: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r5.model.Endpoint.EndpointStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.SUSPENDED; - case ERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ERROR; - case OFF: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.OFF; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ENTEREDINERROR; - case TEST: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.TEST; - default: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - if (src.hasCareManager()) - tgt.setCareManager(convertReference(src.getCareManager())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTeam()) - tgt.addTeam(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) - tgt.addDiagnosis(convertDiagnosisComponent(t)); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - if (src.hasCareManager()) - tgt.setCareManager(convertReference(src.getCareManager())); - for (org.hl7.fhir.r5.model.Reference t : src.getTeam()) - tgt.addTeam(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) - tgt.addAccount(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent(); - copyElement(src, tgt); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Parameters convertExpansionProfile(org.hl7.fhir.dstu3.model.ExpansionProfile src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); - if (src.hasUrl()) - tgt.addParameter("profile-url", src.getUrl()); - if (src.hasVersion()) - tgt.addParameter("profile-version", src.getVersion()); - if (src.hasName()) - tgt.addParameter("profile-name", src.getName()); - if (src.hasStatus()) - tgt.addParameter("profile-status", src.getStatus().toCode()); - - for (org.hl7.fhir.dstu3.model.ExpansionProfile.ExpansionProfileFixedVersionComponent t : src.getFixedVersion()) { - if (t.getMode() == SystemVersionProcessingMode.DEFAULT) - tgt.addParameter("system-version", t.getSystem()+"|"+t.getVersion()); - else if (t.getMode() == SystemVersionProcessingMode.CHECK) - tgt.addParameter("check-system-version", t.getSystem()+"|"+t.getVersion()); - else if (t.getMode() == SystemVersionProcessingMode.OVERRIDE) - tgt.addParameter("force-system-version", t.getSystem()+"|"+t.getVersion()); - } - - if (src.hasExcludedSystem()) { - tgt.addParameter("exclude-system", src.getExcludedSystem().getSystem()+"|"+src.getExcludedSystem().getVersion()); - } - if (src.hasIncludeDesignations()) - tgt.addParameter("includeDesignations", src.getIncludeDesignations()); - - for (DesignationIncludeDesignationComponent t : src.getDesignation().getInclude().getDesignation()) { - if (t.hasLanguage()) - tgt.addParameter("designation", "urn:ietf:bcp:47|"+t.getLanguage()); - if (t.hasUse()) - tgt.addParameter("designation", t.getUse().getSystem()+"|"+t.getUse().getCode()); - } - if (src.hasIncludeDefinition()) - tgt.addParameter("includeDefinition", src.getIncludeDefinition()); - if (src.hasActiveOnly()) - tgt.addParameter("activeOnly", src.getActiveOnly()); - if (src.hasExcludeNested()) - tgt.addParameter("excludeNested", src.getExcludeNested()); - if (src.hasExcludeNotForUI()) - tgt.addParameter("excludeNotForUI", src.getExcludeNotForUI()); - if (src.hasExcludePostCoordinated()) - tgt.addParameter("excludePostCoordinated", src.getExcludePostCoordinated()); - if (src.hasDisplayLanguage()) - tgt.addParameter("excludePostCoordinated", src.getDisplayLanguage()); - if (src.hasLimitedExpansion()) - tgt.addParameter("limitedExpansion", src.getLimitedExpansion()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ExpansionProfile convertExpansionProfile(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile(); - if (src.hasParameter("profile-url")) - tgt.setUrl(src.getParameter("profile-url").primitiveValue()); - if (src.hasParameter("profile-version")) - tgt.setVersion(src.getParameter("profile-version").primitiveValue()); - if (src.hasParameter("profile-name")) - tgt.setName(src.getParameter("profile-name").primitiveValue()); - if (src.hasParameter("profile-status")) - tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue())); - - for (DataType t : src.getParameters("system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT); - } - for (DataType t : src.getParameters("force-system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE); - } - for (DataType t : src.getParameters("check-system-version")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK); - } - for (DataType t : src.getParameters("exclude-system")) { - String[] v = t.primitiveValue().split("\\|"); - tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]); - } - if (src.hasParameter("includeDesignations")) - tgt.setIncludeDesignations(src.getParameterBool("")); - for (DataType t : src.getParameters("designation")) { - String[] v = t.primitiveValue().split("\\|"); - if ("urn:ietf:bcp:47".equals(v[0])) - tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]); - else - tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]); - } - if (src.hasParameter("includeDefinition")) - tgt.setIncludeDefinition(src.getParameterBool("includeDefinition")); - if (src.hasParameter("activeOnly")) - tgt.setActiveOnly(src.getParameterBool("activeOnly")); - if (src.hasParameter("excludeNested")) - tgt.setExcludeNested(src.getParameterBool("excludeNested")); - if (src.hasParameter("excludeNotForUI")) - tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI")); - if (src.hasParameter("excludeNotForUI")) - tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI")); - if (src.hasParameter("displayLanguage")) - tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue()); - if (src.hasParameter("limitedExpansion")) - tgt.setLimitedExpansion(src.getParameterBool("getParameterBool")); - return tgt; - } - - public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiatesCanonical(t.getReference()); - if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - if (src.hasNotDoneReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getNotDoneReason())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRelationship()) - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasGender()) -// tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBorn()) - tgt.setBorn(convertType(src.getBorn())); - if (src.hasAge()) - tgt.setAge(convertType(src.getAge())); - if (src.hasEstimatedAge()) - tgt.setEstimatedAge(src.getEstimatedAge()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) - tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - if (src.hasDataAbsentReason()) - tgt.setNotDoneReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasRelationship()) - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); -// if (src.hasGender()) -// tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBorn()) - tgt.setBorn(convertType(src.getBorn())); - if (src.hasAge()) - tgt.setAge(convertType(src.getAge())); - if (src.hasEstimatedAge()) - tgt.setEstimatedAge(src.getEstimatedAge()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; - } -} - - public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasOnset()) - tgt.setOnset(convertType(src.getOnset())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Goal tgt = new org.hl7.fhir.r5.model.Goal(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setLifecycleStatus(convertGoalStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasStart()) - tgt.setStart(convertType(src.getStart())); - if (src.hasTarget()) - tgt.addTarget(convertGoalTargetComponent(src.getTarget())); - if (src.hasStatusDate()) - tgt.setStatusDate(src.getStatusDate()); - if (src.hasStatusReason()) - tgt.setStatusReason(src.getStatusReason()); - if (src.hasExpressedBy()) - tgt.setExpressedBy(convertReference(src.getExpressedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) - tgt.addOutcome(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) - tgt.addOutcome(convertReferenceToCodableReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r5.model.Goal src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasLifecycleStatus()) - tgt.setStatus(convertGoalStatus(src.getLifecycleStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasStart()) - tgt.setStart(convertType(src.getStart())); - if (src.hasTarget()) - tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep())); - if (src.hasStatusDate()) - tgt.setStatusDate(src.getStatusDate()); - if (src.hasStatusReason()) - tgt.setStatusReason(src.getStatusReason()); - if (src.hasExpressedBy()) - tgt.setExpressedBy(convertReference(src.getExpressedBy())); - for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (CodeableReference t : src.getOutcome()) - if (t.hasConcept()) - tgt.addOutcomeCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getOutcome()) - if (t.hasReference()) - tgt.addOutcomeReference(convertReference(t.getReference())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus convertGoalStatus(org.hl7.fhir.dstu3.model.Goal.GoalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PROPOSED; - case ACCEPTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACCEPTED; - case PLANNED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PLANNED; - case INPROGRESS: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; - case ONTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; - case AHEADOFTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; - case BEHINDTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; - case SUSTAINING: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; - case ACHIEVED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.COMPLETED; - case ONHOLD: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; - case REJECTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.REJECTED; - default: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Goal.GoalStatus convertGoalStatus(org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PROPOSED; - case ACCEPTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACCEPTED; - case PLANNED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACHIEVED; - case ONHOLD: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ENTEREDINERROR; - case REJECTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.REJECTED; - default: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r5.model.Goal.GoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertType(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r5.model.Goal.GoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertType(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.GraphDefinition tgt = new org.hl7.fhir.r5.model.GraphDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r5.model.GraphDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) - tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); - copyElement(src, tgt); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSliceName()) - tgt.setSliceName(src.getSliceName()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) - tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) - tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); - for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(src.getProfile()); - for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) - tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); - for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) - tgt.addLink(convertGraphDefinitionLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCompartmentCode(src.getCode())); - if (src.hasRule()) - tgt.setRule(convertGraphCompartmentRule(src.getRule())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCompartmentCode(src.getCode())); - if (src.hasRule()) - tgt.setRule(convertGraphCompartmentRule(src.getRule())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentCode(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; - default: return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE; - default: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL; - } -} - - private static org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IDENTICAL: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; - case MATCHING: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.MATCHING; - case DIFFERENT: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; - case CUSTOM: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.CUSTOM; - default: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IDENTICAL: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; - case MATCHING: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING; - case DIFFERENT: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; - case CUSTOM: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM; - default: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL; - } -} - - public static org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); - if (src.hasActual()) - tgt.setActual(src.getActual()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasQuantity()) - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); - if (src.hasActual()) - tgt.setActual(src.getActual()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasQuantity()) - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.r5.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.r5.model.Group.GroupType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasExclude()) - tgt.setExclude(src.getExclude()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasExclude()) - tgt.setExclude(src.getExclude()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - if (src.hasEntity()) - tgt.setEntity(convertReference(src.getEntity())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - if (src.hasEntity()) - tgt.setEntity(convertReference(src.getEntity())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - return tgt; - } - - - public static org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasProvidedBy()) - tgt.setProvidedBy(convertReference(src.getProvidedBy())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasExtraDetails()) - tgt.setExtraDetails(src.getExtraDetails()); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility() || src.hasEligibilityNote()) { - HealthcareServiceEligibilityComponent t = tgt.addEligibility(); - t.setCode(convertCodeableConcept(src.getEligibility())); - if (src.hasEligibilityNote()) - t.setComment(src.getEligibilityNote()); - } - for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) - tgt.addProgram().setText(t.getValue()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); - if (src.hasAppointmentRequired()) - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasProvidedBy()) - tgt.setProvidedBy(convertReference(src.getProvidedBy())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasExtraDetails()) - tgt.setExtraDetails(src.getExtraDetails()); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - if (src.hasEligibility()) { - tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); - if (src.getEligibilityFirstRep().hasComment()) - tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); - } - for (CodeableConcept t : src.getProgram()) - tgt.addProgramName(t.getText()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); - if (src.hasAppointmentRequired()) - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; - default: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; - } -} - - public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - private static final String URN_DICOM_UID = "urn:dicom:uid"; - - public static org.hl7.fhir.r5.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImagingStudy tgt = new org.hl7.fhir.r5.model.ImagingStudy(); - copyDomainResource(src, tgt); - - if (src.hasUid()) { - org.hl7.fhir.r5.model.Identifier i = new org.hl7.fhir.r5.model.Identifier(); - i.setSystem(URN_DICOM_UID); - i.setValue(src.getUid()); - tgt.addIdentifier(i); - } - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - - if (src.hasAccession()) - tgt.addIdentifier(convertIdentifier(src.getAccession())); - - if (src.hasAvailability()) { - org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability availability = src.getAvailability(); - switch (availability) { - case OFFLINE: - tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.REGISTERED); - break; - case UNAVAILABLE: - tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.CANCELLED); - break; - case ONLINE: - case NEARLINE: - tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.AVAILABLE); - break; - default: - break; - } - } else { - tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.UNKNOWN); - } - - for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) { - tgt.addModality(convertCoding(t)); - } - - if (src.hasPatient()) - tgt.setSubject(convertReference(src.getPatient())); - if (src.hasContext()) { - tgt.setEncounter(convertReference(src.getContext())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasReferrer()) { - tgt.setReferrer(convertReference(src.getReferrer())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) { - tgt.addInterpreter(convertReference(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasNumberOfSeries()) { - tgt.setNumberOfSeries(src.getNumberOfSeries()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - List procedureReferences = src.getProcedureReference(); - if (procedureReferences.size() > 0) { - tgt.addProcedure().setValue(convertReference(procedureReferences.get(0))); - } - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProcedureCode()) { - tgt.addProcedure().setValue(convertCodeableConcept(t)); - } - if (src.hasReason()) { - tgt.addReason(convertCodeableConceptToCodableReference(src.getReason())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { - tgt.addSeries(convertImagingStudySeriesComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r5.model.ImagingStudy src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { - - // assuming that there is only one urn:dicom:uid identifier - if (URN_DICOM_UID.equals(t.getSystem())) { - tgt.setUid(t.getValue()); - } else { - tgt.addIdentifier(convertIdentifier(t)); - } - } - if (src.hasStatus()) { - org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus s = src.getStatus(); - switch (s) { - case REGISTERED: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE); - break; - case AVAILABLE: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE); - break; - case CANCELLED: - tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); - break; - default: - break; - } - } - for (org.hl7.fhir.r5.model.Coding t : src.getModality()) { - tgt.addModalityList(convertCoding(t)); - } - if (src.hasSubject()) { - tgt.setPatient(convertReference(src.getSubject())); - } - if (src.hasEncounter()) { - tgt.setContext(convertReference(src.getEncounter())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) { - tgt.addBasedOn(convertReference(t)); - } - if (src.hasReferrer()) { - tgt.setReferrer(convertReference(src.getReferrer())); - } - for (org.hl7.fhir.r5.model.Reference t : src.getInterpreter()) { - tgt.addInterpreter(convertReference(t)); - } - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasNumberOfSeries()) { - tgt.setNumberOfSeries(src.getNumberOfSeries()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - for (ImagingStudyProcedureComponent t : src.getProcedure()) { - if (t.hasValueReference()) { - tgt.addProcedureReference(convertReference(t.getValueReference())); - } else { - tgt.addProcedureCode(convertCodeableConcept(t.getValueCodeableConcept())); - } - } - // location was added in R4 and does not exist in DSTU3 - List reasonCodes = src.getReason(); - if (reasonCodes.size() > 0) { - tgt.setReason(convertCodeableConcept(reasonCodes.get(0).getConcept())); - - if (reasonCodes.size() > 1) { - // TODO print a warning that only one reason could be converted - } - } - // reasonReference was added in R4 and does not exist in DSTU3 - // node was added in R4 and does not exist in DSTU3 - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - - for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { - tgt.addSeries(convertImagingStudySeriesComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasModality()) { - tgt.setModality(convertCoding(src.getModality())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCoding(src.getBodySite())); - } - if (src.hasLaterality()) { - tgt.setLaterality(convertCoding(src.getLaterality())); - } - // the specimen element was added in R4 and does not exist in DSTU3 - if (src.hasStarted()) { - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasModality()) { - tgt.setModality(convertCoding(src.getModality())); - } - if (src.hasDescription()) { - tgt.setDescription(src.getDescription()); - } - if (src.hasNumberOfInstances()) { - tgt.setNumberOfInstances(src.getNumberOfInstances()); - } - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) { - tgt.addEndpoint(convertReference(t)); - } - if (src.hasBodySite()) { - tgt.setBodySite(convertCoding(src.getBodySite())); - } - if (src.hasLaterality()) { - tgt.setLaterality(convertCoding(src.getLaterality())); - } - if (src.hasStarted()) { - - tgt.setStartedElement(convertDateTime(src.getStartedElement())); - } - // the specimen element was added in R4 and does not exist in DSTU3 - - for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - } - - return tgt; - } - - private static final String URN_IETF_RFC_3986 = "urn:ietf:rfc:3986"; - - private static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - if (src.hasSopClass()) { - org.hl7.fhir.r5.model.Coding c = new org.hl7.fhir.r5.model.Coding(); - c.setSystem(URN_IETF_RFC_3986); - c.setCode(src.getSopClass()); - tgt.setSopClass(c); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - - if (src.hasUid()) { - tgt.setUid(src.getUid()); - } - org.hl7.fhir.r5.model.Coding sop = src.getSopClass(); - if (URN_IETF_RFC_3986.equals(sop.getSystem())) { - tgt.setSopClass(sop.getCode()); - } - if (src.hasNumber()) { - tgt.setNumber(src.getNumber()); - } - if (src.hasTitle()) { - tgt.setTitle(src.getTitle()); - } - - return tgt; - } - - public static org.hl7.fhir.r5.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Immunization tgt = new org.hl7.fhir.r5.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertImmunizationStatus(src.getStatus())); - if (src.hasVaccineCode()) - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDate()) - tgt.setOccurrence(convertDateTime(src.getDateElement())); - if (src.hasPrimarySource()) - tgt.setPrimarySource(src.getPrimarySource()); - if (src.hasReportOrigin()) - tgt.setInformationSource(convertCodeableConcept(src.getReportOrigin())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDate(src.getExpirationDate()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasDoseQuantity()) - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent t : src.getPractitioner()) - tgt.addPerformer(convertImmunizationPractitionerComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReason()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReasonNotGiven()) -// tgt.addReason(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertImmunizationStatus(src.getStatus())); - if (src.hasVaccineCode()) - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasOccurrenceDateTimeType()) - tgt.setDateElement(convertDateTime(src.getOccurrenceDateTimeType())); - if (src.hasPrimarySource()) - tgt.setPrimarySource(src.getPrimarySource()); - if (src.hasInformationSourceCodeableConcept()) - tgt.setReportOrigin(convertCodeableConcept(src.getInformationSourceCodeableConcept())); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDate(src.getExpirationDate()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasDoseQuantity()) - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) - tgt.addPractitioner(convertImmunizationPractitionerComponent(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.getExplanation().addReason(convertCodeableConcept(t.getConcept())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes convertImmunizationStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setFunction(convertCodeableConcept(src.getRole())); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent(); - copyElement(src, tgt); - if (src.hasFunction()) - tgt.setRole(convertCodeableConcept(src.getFunction())); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); - return tgt; - } - - - - public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - if (src.hasPage()) - tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - for (Enumeration v : src.getFhirVersion()) { - tgt.setFhirVersion(v.asStringValue()); - break; - } - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) { - findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); - } - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); -// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) -// tgt.addBinary(t.getValue()); - if (src.getDefinition().hasPage()) - tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) - if (t.hasId() && t.getId().equals(id)) - return t; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - t1.setName("Default Package"); - t1.setId(id); - return t1; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); - copyElement(src, tgt); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if ( org.hl7.fhir.dstu3.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { - tgt.setPackageId(org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); - } - if ( org.hl7.fhir.dstu3.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { - tgt.setVersion(org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasPackageId()) - tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION, new org.hl7.fhir.dstu3.model.IdType(src.getPackageId()))); - if (src.hasVersion()) - tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION, new org.hl7.fhir.dstu3.model.StringType(src.getVersion()))); - return tgt; - } - - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); - tgt.setId("p"+(context.getGrouping().size()+1)); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); - tn.setGroupingId(tgt.getId()); - context.addResource(tn); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setId(src.getId()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleFor()) { - org.hl7.fhir.r5.model.DataType t = convertType(src.getExampleFor()); - tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); - } else if (src.hasExample()) - tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasSourceReference()) - tgt.setReference(convertReference(src.getSourceReference())); - else if (src.hasSourceUriType()) - tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.hasExampleCanonicalType()) { - tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); - tgt.setExample(true); - } else if (src.hasExampleBooleanType()) - tgt.setExample(src.getExampleBooleanType().getValue()); - else - tgt.setExample(false); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasReference()) - tgt.setSource(convertReference(src.getReference())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); - copyElement(src, tgt); - if (src.hasSource()) - tgt.setName(convertUriToUrl(src.getSourceElement())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasKind()) - tgt.setGeneration(convertPageGeneration(src.getKind())); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration convertPageGeneration(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind kind) { - switch (kind) { - case PAGE: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.HTML; - default: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.GENERATED; - } - } - - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertPageGeneration(org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration generation) { - switch (generation) { - case HTML: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - } - } - - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - if (src.hasNameUrlType()) - tgt.setSource(src.getNameUrlType().getValue()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasGeneration()) - tgt.setKind(convertPageGeneration(src.getGeneration())); - for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - - public static org.hl7.fhir.r5.model.Linkage convertLinkage(org.hl7.fhir.dstu3.model.Linkage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Linkage tgt = new org.hl7.fhir.r5.model.Linkage(); - copyDomainResource(src, tgt); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent t : src.getItem()) - tgt.addItem(convertLinkageItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Linkage convertLinkage(org.hl7.fhir.r5.model.Linkage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Linkage tgt = new org.hl7.fhir.dstu3.model.Linkage(); - copyDomainResource(src, tgt); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - for (org.hl7.fhir.r5.model.Linkage.LinkageItemComponent t : src.getItem()) - tgt.addItem(convertLinkageItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r5.model.Linkage.LinkageItemComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertLinkageType(src.getType())); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r5.model.Linkage.LinkageItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertLinkageType(src.getType())); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.dstu3.model.Linkage.LinkageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r5.model.Linkage.LinkageType.SOURCE; - case ALTERNATE: return org.hl7.fhir.r5.model.Linkage.LinkageType.ALTERNATE; - case HISTORICAL: return org.hl7.fhir.r5.model.Linkage.LinkageType.HISTORICAL; - default: return org.hl7.fhir.r5.model.Linkage.LinkageType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r5.model.Linkage.LinkageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.SOURCE; - case ALTERNATE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.ALTERNATE; - case HISTORICAL: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.HISTORICAL; - default: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.NULL; - } -} - - public static org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntryComponent(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setEncounter(convertReference(src.getEncounter())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - if (src.hasOrderedBy()) - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntryComponent(t)); - if (src.hasEmptyReason()) - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - return tgt; - } - - private static org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; - default: return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent convertListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent(); - copyElement(src, tgt); - if (src.hasFlag()) - tgt.setFlag(convertCodeableConcept(src.getFlag())); - if (src.hasDeleted()) - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasItem()) - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); - copyElement(src, tgt); - if (src.hasFlag()) - tgt.setFlag(convertCodeableConcept(src.getFlag())); - if (src.hasDeleted()) - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasItem()) - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); - if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); - if (src.hasType()) - tgt.addType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasPhysicalType()) - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - if (src.hasPosition()) - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); - if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasPhysicalType()) - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - if (src.hasPosition()) - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.r5.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.r5.model.Location.LocationMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - if (src.hasLongitude()) - tgt.setLongitude(src.getLongitude()); - if (src.hasLatitude()) - tgt.setLatitude(src.getLatitude()); - if (src.hasAltitude()) - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - if (src.hasLongitude()) - tgt.setLongitude(src.getLongitude()); - if (src.hasLatitude()) - tgt.setLatitude(src.getLatitude()); - if (src.hasAltitude()) - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - private static final String CODE_SYSTEM_MEDIA_TYPE = "http://terminology.hl7.org/CodeSystem/media-type"; - - public static org.hl7.fhir.r5.model.DocumentReference convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); - copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { -// tgt.addIdentifier(convertIdentifier(t)); -// } -// for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { -// tgt.addBasedOn(convertReference(t)); -// } -// if (src.hasType()) { -// org.hl7.fhir.r5.model.Coding coding = new org.hl7.fhir.r5.model.Coding(); -// coding.setSystem(CODE_SYSTEM_MEDIA_TYPE); -// coding.setCode(src.getType().toCode().replace("photo", "image")); -// CodeableConcept codeableConcept = new CodeableConcept(coding); -// tgt.setType(codeableConcept); -// } -// if (src.hasSubtype()) { -// tgt.setModality(convertCodeableConcept(src.getSubtype())); -// } -// if (src.hasView()) { -// tgt.setView(convertCodeableConcept(src.getView())); -// } -// if (src.hasSubject()) { -// tgt.setSubject(convertReference(src.getSubject())); -// } -// if (src.hasContext()) { -// tgt.setEncounter(convertReference(src.getContext())); -// } -// if (src.hasOccurrence()) { -// tgt.setCreated(convertType(src.getOccurrence())); -// } -// if (src.hasOperator()) { -// tgt.setOperator(convertReference(src.getOperator())); -// } -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { -// tgt.addReasonCode(convertCodeableConcept(t)); -// } -// if (src.hasBodySite()) { -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// } -// if (src.hasDevice()) { -// tgt.setDevice(convertReference(src.getDevice())); -// } -// if (src.hasHeight()) { -// tgt.setHeight(src.getHeight()); -// } -// if (src.hasWidth()) { -// tgt.setWidth(src.getWidth()); -// } -// if (src.hasFrames()) { -// tgt.setFrames(src.getFrames()); -// } -// if (src.hasDuration()) { -// tgt.setDuration(src.getDuration()); -// } -// if (src.hasContent()) { -// tgt.setContent(convertAttachment(src.getContent())); -// } -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { -// tgt.addNote(convertAnnotation(t)); -// } -// tgt.setStatus(org.hl7.fhir.r5.model.Media.MediaStatus.COMPLETED); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); - copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { -// tgt.addIdentifier(convertIdentifier(t)); -// } -// for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) { -// tgt.addBasedOn(convertReference(t)); -// } -// if (src.hasType()) { -// CodeableConcept type = src.getType(); -// for (org.hl7.fhir.r5.model.Coding c : type.getCoding()) { -// if (CODE_SYSTEM_MEDIA_TYPE.equals(c.getSystem())) { -// tgt.setType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.fromCode(c.getCode().replace("image", "photo"))); -// break; -// } -// } -// } -// if (src.hasModality()) { -// tgt.setSubtype(convertCodeableConcept(src.getModality())); -// } -// if (src.hasView()) { -// tgt.setView(convertCodeableConcept(src.getView())); -// } -// if (src.hasSubject()) { -// tgt.setSubject(convertReference(src.getSubject())); -// } -// if (src.hasEncounter()) { -// tgt.setContext(convertReference(src.getEncounter())); -// } -// if (src.hasCreated()) { -// tgt.setOccurrence(convertType(src.getCreated())); -// } -// if (src.hasOperator()) { -// tgt.setOperator(convertReference(src.getOperator())); -// } -// for (CodeableConcept t : src.getReasonCode()) { -// tgt.addReasonCode(convertCodeableConcept(t)); -// } -// if (src.hasBodySite()) { -// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); -// } -// if (src.hasDevice()) { -// tgt.setDevice(convertReference(src.getDevice())); -// } -// if (src.hasHeight()) { -// tgt.setHeight(src.getHeight()); -// } -// if (src.hasWidth()) { -// tgt.setWidth(src.getWidth()); -// } -// if (src.hasFrames()) { -// tgt.setFrames(src.getFrames()); -// } -// if (src.hasDuration()) { -// tgt.setDuration(src.getDuration().intValue()); -// } -// if (src.hasContent()) { -// tgt.setContent(convertAttachment(src.getContent())); -// } -// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) { -// tgt.addNote(convertAnnotation(t)); -// } - return tgt; - } - - public static org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); - copyDomainResource(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatus(src.getStatus())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasForm()) - tgt.setDoseForm(convertCodeableConcept(src.getForm())); - for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertMedicationIngredientComponent(t)); - if (src.hasPackage()) - tgt.setBatch(convertMedicationPackageBatchComponent(src.getPackage().getBatchFirstRep())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); - copyDomainResource(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatus(src.getStatus())); - if (src.hasManufacturer()) - tgt.setManufacturer(convertReference(src.getManufacturer())); - if (src.hasDoseForm()) - tgt.setForm(convertCodeableConcept(src.getDoseForm())); - for (org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertMedicationIngredientComponent(t)); - if (src.hasBatch()) - tgt.getPackage().addBatch(convertMedicationPackageBatchComponent(src.getBatch())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Medication.MedicationStatusCodes convertMedicationStatus(org.hl7.fhir.dstu3.model.Medication.MedicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.ACTIVE; - case INACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r5.model.Medication.MedicationStatusCodes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent(); - copyElement(src, tgt); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - if (src.hasIsActive()) - tgt.setIsActive(src.getIsActive()); - if (src.hasAmount()) - tgt.setStrength(convertRatio(src.getAmount())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent(); - copyElement(src, tgt); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - if (src.hasIsActive()) - tgt.setIsActive(src.getIsActive()); - if (src.hasStrengthRatio()) - tgt.setAmount(convertRatio(src.getStrengthRatio())); - return tgt; - } - - - public static org.hl7.fhir.r5.model.Medication.MedicationBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationBatchComponent(); - copyElement(src, tgt); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDate(src.getExpirationDate()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationBatchComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent(); - copyElement(src, tgt); - if (src.hasLotNumber()) - tgt.setLotNumber(src.getLotNumber()); - if (src.hasExpirationDate()) - tgt.setExpirationDate(src.getExpirationDate()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.dstu3.model.MedicationAdministration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationAdministration tgt = new org.hl7.fhir.r5.model.MedicationAdministration(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) - tgt.addInstantiatesUri(t.getReference()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatusElement(convertMedicationAdministrationStatus(src.getStatusElement())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasEffective()) - tgt.setOccurence(convertType(src.getEffective())); - for (org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); -// if (src.hasNotGiven()) -// tgt.setNotGiven(src.getNotGiven()); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) -// tgt.addReasonNotGiven(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - if (src.hasPrescription()) - tgt.setRequest(convertReference(src.getPrescription())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDevice()) - tgt.addDevice(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - if (src.hasDosage()) - tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r5.model.MedicationAdministration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) - tgt.addDefinition().setReference(t.getValue()); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatusElement(convertMedicationAdministrationStatus(src.getStatusElement())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasOccurence()) - tgt.setEffective(convertType(src.getOccurence())); - for (org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); -// if (src.hasNotGiven()) -// tgt.setNotGiven(src.getNotGiven()); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotGiven()) -// tgt.addReasonNotGiven(convertCodeableConcept(t)); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - if (src.hasRequest()) - tgt.setPrescription(convertReference(src.getRequest())); - for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) - tgt.addDevice(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - if (src.hasDosage()) - tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); - for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Enumeration convertMedicationAdministrationStatus(org.hl7.fhir.r5.model.Enumeration src) { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration(); - copyElement(src, tgt); - tgt.setValue(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus.fromCode(src.getValueAsString())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumeration convertMedicationAdministrationStatus(org.hl7.fhir.dstu3.model.Enumeration src) { - if (src == null) - return null; - org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(); - copyElement(src, tgt); - tgt.setValue(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationStatusCodes.fromCode(src.getValueAsString())); - return tgt; - } - - - public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent(); - copyElement(src, tgt); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertSimpleQuantity(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent(); - copyElement(src, tgt); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasSite()) - tgt.setSite(convertCodeableConcept(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertSimpleQuantity(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - for (org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasDaysSupply()) - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - if (src.hasWhenPrepared()) - tgt.setWhenPrepared(src.getWhenPrepared()); - if (src.hasWhenHandedOver()) - tgt.setWhenHandedOver(src.getWhenHandedOver()); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); -// if (src.hasNotDone()) -// tgt.setNotDone(src.getNotDone()); -// if (src.hasNotDoneReason()) -// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - for (org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasDaysSupply()) - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - if (src.hasWhenPrepared()) - tgt.setWhenPrepared(src.getWhenPrepared()); - if (src.hasWhenHandedOver()) - tgt.setWhenHandedOver(src.getWhenHandedOver()); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); -// if (src.hasNotDone()) -// tgt.setNotDone(src.getNotDone()); -// if (src.hasNotDoneReason()) -// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); - for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodesEnumFactory()); - copyElement(src, tgt); - switch (src.getValue()) { - case PREPARATION: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.PREPARATION); break; - case INPROGRESS: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.INPROGRESS); break; - case ONHOLD: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ONHOLD); break; - case COMPLETED: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED); break; - case ENTEREDINERROR: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ENTEREDINERROR); break; - case STOPPED: tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED); break; - case NULL:tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.NULL); break; - } - return tgt; -} - - private static org.hl7.fhir.dstu3.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { - if (src == null) - return null; - - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration(); - copyElement(src, tgt); - switch (src.getValue()) { - case PREPARATION: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.PREPARATION); break; - case INPROGRESS: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); break; - case ONHOLD: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); break; - case COMPLETED: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); break; - case ENTEREDINERROR: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); break; - case STOPPED: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED); break; - case DECLINED: tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED); break; - case NULL:tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL); break; - } - return tgt; - - } - - public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent(); - copyElement(src, tgt); - if (src.hasActor()) - tgt.setActor(convertReference(src.getActor())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasWasSubstituted()) - tgt.setWasSubstituted(src.getWasSubstituted()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) - tgt.setResponsibleParty(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasWasSubstituted()) - tgt.setWasSubstituted(src.getWasSubstituted()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - if (src.hasResponsibleParty()) - tgt.addResponsibleParty(convertReference(src.getResponsibleParty())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) -// tgt.addDefinition(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasGroupIdentifier()) - tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); - if (src.hasIntent()) - tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasPriority()) - tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasAuthoredOn()) - tgt.setAuthoredOn(src.getAuthoredOn()); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(new CodeableReference().setConcept(convertCodeableConcept(t))); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(new CodeableReference().setReference(convertReference(t))); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasDispenseRequest()) - tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); - if (src.hasPriorPrescription()) - tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// for (org.hl7.fhir.r5.model.Reference t : src.getDefinition()) -// tgt.addDefinition(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasGroupIdentifier()) - tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); - if (src.hasIntent()) - tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); -// if (src.hasCategory()) -// tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasPriority()) - tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasAuthoredOn()) - tgt.setAuthoredOn(src.getAuthoredOn()); - if (src.hasRecorder()) - tgt.setRecorder(convertReference(src.getRecorder())); - for (CodeableReference t : src.getReason()) { - if (t.hasConcept()) { - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - } - if (t.hasReference()) { - tgt.addReasonReference(convertReference(t.getReference())); - } - } - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertDosage(t)); - if (src.hasDispenseRequest()) - tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); - if (src.hasSubstitution()) - tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); - if (src.hasPriorPrescription()) - tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); - for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) - tgt.addDetectedIssue(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) - tgt.addEventHistory(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.STOPPED; - case DRAFT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.DRAFT; - case UNKNOWN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD; - case CANCELLED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED; - case DRAFT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT; - case UNKNOWN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSAL: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; - case PLAN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN; - case ORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER; - case INSTANCEORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; - default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSAL: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; - case PLAN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN; - case ORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER; - case INSTANCEORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.RequestPriority convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT; - case STAT: return org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT; - case ASAP: return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP; - default: return org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r5.model.Enumerations.RequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT; - case STAT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT; - case ASAP: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP; - default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL; - } -} -// -// public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent(); -// copyElement(src, tgt); -// if (src.hasAgent()) -// tgt.setAgent(convertReference(src.getAgent())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent(); -// copyElement(src, tgt); -// if (src.hasAgent()) -// tgt.setAgent(convertReference(src.getAgent())); -// if (src.hasOnBehalfOf()) -// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); - copyElement(src, tgt); - if (src.hasValidityPeriod()) - tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); - if (src.hasNumberOfRepeatsAllowed()) - tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasExpectedSupplyDuration()) - tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); - if (src.hasPerformer()) - tgt.setDispenser(convertReference(src.getPerformer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); - copyElement(src, tgt); - if (src.hasValidityPeriod()) - tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); - if (src.hasNumberOfRepeatsAllowed()) - tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasExpectedSupplyDuration()) - tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); - if (src.hasDispenser()) - tgt.setPerformer(convertReference(src.getDispenser())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasAllowed()) - tgt.setAllowed(convertBoolean(src.getAllowedElement())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent(); - copyElement(src, tgt); - if (src.hasAllowedBooleanType()) - tgt.setAllowedElement(convertBoolean(src.getAllowedBooleanType())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MedicationUsage convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MedicationUsage tgt = new org.hl7.fhir.r5.model.MedicationUsage(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - if (src.hasCategory()) - tgt.addCategory(convertCodeableConcept(src.getCategory())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); - if (src.hasInformationSource()) - tgt.setInformationSource(convertReference(src.getInformationSource())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) - tgt.addDerivedFrom(convertReference(t)); -// if (src.hasTaken()) -// tgt.addExtension(convertMedicationStatementTaken(src.getTaken())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConceptToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReason(convertReferenceToCodableReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationUsage src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - if (src.hasMedication()) - tgt.setMedication(convertType(src.getMedication())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); - if (src.hasInformationSource()) - tgt.setInformationSource(convertReference(src.getInformationSource())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) - tgt.addDerivedFrom(convertReference(t)); -// if (src.hasExtension(VersionConvertorConstants.MODIFIER_TAKEN)) -// tgt.setTaken(convertMedicationStatementTaken(src.getExtensionByUrl(VersionConvertorConstants.MODIFIER_TAKEN))); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotTaken()) -// tgt.addReasonNotTaken(convertCodeableConcept(t)); - for (CodeableReference t : src.getReason()) - if (t.hasConcept()) - tgt.addReasonCode(convertCodeableConcept(t.getConcept())); - for (CodeableReference t : src.getReason()) - if (t.hasReference()) - tgt.addReasonReference(convertReference(t.getReference())); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) - tgt.addDosage(convertDosage(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE; - case COMPLETED: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED; - case STOPPED: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.STOPPED; - case ONHOLD: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ONHOLD; - default: return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD; - default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; - } -} -// -// private static org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case Y: return org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken.Y; -// case N: return org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken.N; -// case UNK: return org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken.UNK; -// case NA: return org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken.NA; -// default: return org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.r5.model.MedicationUsage.MedicationStatementTaken src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case Y: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.Y; -// case N: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.N; -// case UNK: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.UNK; -// case NA: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NA; -// default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NULL; -// } -//} - - public static org.hl7.fhir.r5.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.dstu3.model.MessageDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageDefinition tgt = new org.hl7.fhir.r5.model.MessageDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasBase()) - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.getParent().add(convertReferenceToCanonical(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) - tgt.getReplaces().add(convertReferenceToCanonical(t)); - if (src.hasEvent()) - tgt.setEvent(convertCoding(src.getEvent())); - if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) - tgt.addFocus(convertMessageDefinitionFocusComponent(t)); - if (src.hasResponseRequired()) - tgt.setResponseRequired(src.getResponseRequired() ? org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS : org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); - for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) - tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); - return tgt; - } - - public static String convertCoding2Uri(org.hl7.fhir.dstu3.model.Coding code) { - return code.getSystem()+"/"+code.getCode(); - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r5.model.MessageDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition tgt = new org.hl7.fhir.dstu3.model.MessageDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - for (org.hl7.fhir.r5.model.CanonicalType t : src.getParent()) - tgt.addParent(convertCanonicalToReference(t)); - for (org.hl7.fhir.r5.model.CanonicalType t : src.getReplaces()) - tgt.addReplaces(convertCanonicalToReference(t)); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) - tgt.addFocus(convertMessageDefinitionFocusComponent(t)); - if (src.hasResponseRequired()) - tgt.setResponseRequired(src.getResponseRequired() != org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); - for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) - tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertUri2Coding(String uri) { - int i = uri.lastIndexOf("/"); - return new org.hl7.fhir.dstu3.model.Coding().setSystem(uri.substring(0, i)).setCode(uri.substring(i+1)); - } - - private static org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NULL; - } -} - - public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasProfile()) - tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); - copyElement(src, tgt); - if (src.hasMessage()) - tgt.setMessageElement(convertReferenceToCanonical(src.getMessage())); - if (src.hasSituation()) - tgt.setSituation(src.getSituation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); - copyElement(src, tgt); - if (src.hasMessage()) - tgt.setMessage(convertCanonicalToReference(src.getMessageElement())); - if (src.hasSituation()) - tgt.setSituation(src.getSituation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); - copyDomainResource(src, tgt); - if (src.hasEvent()) - tgt.setEvent(convertCoding(src.getEvent())); - for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); -// if (src.hasTimestamp()) -// tgt.setTimestamp(src.getTimestamp()); - if (src.hasEnterer()) - tgt.setEnterer(convertReference(src.getEnterer())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertMessageSourceComponent(src.getSource())); - if (src.hasResponsible()) - tgt.setResponsible(convertReference(src.getResponsible())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - if (src.hasResponse()) - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); - copyDomainResource(src, tgt); - if (src.hasEventCoding()) - tgt.setEvent(convertCoding(src.getEventCoding())); - for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - if (src.hasSender()) - tgt.setSender(convertReference(src.getSender())); -// if (src.hasTimestamp()) -// tgt.setTimestamp(src.getTimestamp()); - if (src.hasEnterer()) - tgt.setEnterer(convertReference(src.getEnterer())); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertMessageSourceComponent(src.getSource())); - if (src.hasResponsible()) - tgt.setResponsible(convertReference(src.getResponsible())); - if (src.hasReason()) - tgt.setReason(convertCodeableConcept(src.getReason())); - if (src.hasResponse()) - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSoftware()) - tgt.setSoftware(src.getSoftware()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasContact()) - tgt.setContact(convertContactPoint(src.getContact())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasSoftware()) - tgt.setSoftware(src.getSoftware()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasContact()) - tgt.setContact(convertContactPoint(src.getContact())); - if (src.hasEndpoint()) - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - private static org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; - } -} - - public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); - copyDomainResource(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } -} - - public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } -} - -// public static org.hl7.fhir.r5.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.dstu3.model.NutritionOrder src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder tgt = new org.hl7.fhir.r5.model.NutritionOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateTime()) -// tgt.setDateTime(src.getDateTime()); -// if (src.hasOrderer()) -// tgt.setOrderer(convertReference(src.getOrderer())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getAllergyIntolerance()) -// tgt.addAllergyIntolerance(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFoodPreferenceModifier()) -// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExcludeFoodModifier()) -// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); -// if (src.hasOralDiet()) -// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) -// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); -// if (src.hasEnteralFormula()) -// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.r5.model.NutritionOrder src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder tgt = new org.hl7.fhir.dstu3.model.NutritionOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateTime()) -// tgt.setDateTime(src.getDateTime()); -// if (src.hasOrderer()) -// tgt.setOrderer(convertReference(src.getOrderer())); -// for (org.hl7.fhir.r5.model.Reference t : src.getAllergyIntolerance()) -// tgt.addAllergyIntolerance(convertReference(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFoodPreferenceModifier()) -// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getExcludeFoodModifier()) -// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); -// if (src.hasOralDiet()) -// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); -// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) -// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); -// if (src.hasEnteralFormula()) -// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.CANCELLED; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.CANCELLED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) -// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) -// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFluidConsistencyType()) -// tgt.addFluidConsistencyType(convertCodeableConcept(t)); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) -// tgt.addType(convertCodeableConcept(t)); -// for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) -// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); -// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) -// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); -// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFluidConsistencyType()) -// tgt.addFluidConsistencyType(convertCodeableConcept(t)); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasAmount()) -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasAmount()) -// tgt.setAmount(convertSimpleQuantity(src.getAmount())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasFoodType()) -// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); -// copyElement(src, tgt); -// if (src.hasModifier()) -// tgt.setModifier(convertCodeableConcept(src.getModifier())); -// if (src.hasFoodType()) -// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasProductName()) -// tgt.setProductName(src.getProductName()); -// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertCodeableConcept(src.getType())); -// if (src.hasProductName()) -// tgt.setProductName(src.getProductName()); -// for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) -// tgt.addSchedule(convertTiming(t)); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasInstruction()) -// tgt.setInstruction(src.getInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); -// copyElement(src, tgt); -// if (src.hasBaseFormulaType()) -// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); -// if (src.hasBaseFormulaProductName()) -// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); -// if (src.hasAdditiveType()) -// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); -// if (src.hasAdditiveProductName()) -// tgt.setAdditiveProductName(src.getAdditiveProductName()); -// if (src.hasCaloricDensity()) -// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); -// if (src.hasRouteofAdministration()) -// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); -// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) -// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); -// if (src.hasMaxVolumeToDeliver()) -// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); -// if (src.hasAdministrationInstruction()) -// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); -// copyElement(src, tgt); -// if (src.hasBaseFormulaType()) -// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); -// if (src.hasBaseFormulaProductName()) -// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); -// if (src.hasAdditiveType()) -// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); -// if (src.hasAdditiveProductName()) -// tgt.setAdditiveProductName(src.getAdditiveProductName()); -// if (src.hasCaloricDensity()) -// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); -// if (src.hasRouteofAdministration()) -// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); -// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) -// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); -// if (src.hasMaxVolumeToDeliver()) -// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); -// if (src.hasAdministrationInstruction()) -// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); -// return tgt; -// } -// -// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); -// copyElement(src, tgt); -// if (src.hasSchedule()) -// tgt.setSchedule(convertTiming(src.getSchedule())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasRate()) -// tgt.setRate(convertType(src.getRate())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); -// copyElement(src, tgt); -// if (src.hasSchedule()) -// tgt.setSchedule(convertTiming(src.getSchedule())); -// if (src.hasQuantity()) -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// if (src.hasRate()) -// tgt.setRate(convertType(src.getRate())); -// return tgt; -// } - - public static org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - if (src.hasComment()) - tgt.addNote().setText(src.getComment()); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) - if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER) - tgt.addHasMember(convertReference(t.getTarget())); - else if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM) - tgt.addDerivedFrom(convertReference(t.getTarget())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasEffective()) - tgt.setEffective(convertType(src.getEffective())); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - if (src.hasNote()) - tgt.setComment(src.getNoteFirstRep().getText()); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER)); - for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) - tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM)); - for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAppliesTo()) - tgt.addAppliesTo(convertCodeableConcept(t)); - if (src.hasAge()) - tgt.setAge(convertRange(src.getAge())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) - tgt.addAppliesTo(convertCodeableConcept(t)); - if (src.hasAge()) - tgt.setAge(convertRange(src.getAge())); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType type) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(type); - tgt.setTarget(convertReference(src)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - if (src.hasDataAbsentReason()) - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - if (src.hasInterpretation()) - tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); - for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasIdempotent()) - tgt.setAffectsState(!src.getIdempotent()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasBase()) - tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addResource(t.getValue()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasInstance()) - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) - tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasAffectsState()) - tgt.setIdempotent(!src.getAffectsState()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertCanonicalToReference(src.getBaseElement())); - for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) - tgt.addResource(t.getValue()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasInstance()) - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) - tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } -} - - public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); - if (src.hasSearchType()) - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - if (src.hasProfile()) - tgt.addTargetProfile(src.getProfile().getReference()); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType().toCode()); - if (src.hasSearchType()) - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) - tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; - default: return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } -} - - public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - DataType t = convertType(src.getValueSet()); - if (t instanceof org.hl7.fhir.r5.model.Reference) - tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); - else - tgt.setValueSet(t.primitiveValue()); - tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - if (src.hasStrength()) - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasValueSet()) { - String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); - if (vsr != null) - tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); - else - tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParameterName()) - tgt.addParameterName(t.getValue()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.StringType t : src.getParameterName()) - tgt.addParameterName(t.getValue()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); - if (src.hasDetails()) - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } -} - - private static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPartOf()) - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - if (src.hasPurpose()) - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - if (src.hasPurpose()) - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasMaritalStatus()) - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - if (src.hasMultipleBirth()) - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasAnimal()) - tgt.addExtension(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) - tgt.addGeneralPractitioner(convertReference(t)); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - if (src.hasDeceased()) - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasMaritalStatus()) - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - if (src.hasMultipleBirth()) - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) - tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); - for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) - tgt.addGeneralPractitioner(convertReference(t)); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - if (src.hasName()) - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasAddress()) - tgt.setAddress(convertAddress(src.getAddress())); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); - tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); - copyElement(src, tgt); - if (src.hasSpecies()) - tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); - if (src.hasBreed()) - tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); - if (src.hasGenderStatus()) - tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); - copyElement(src, tgt); - if (src.hasExtension("species")) - tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); - if (src.hasExtension("breed")) - tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); - if (src.hasExtension("genderStatus")) - tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - if (src.hasOther()) - tgt.setOther(convertReference(src.getOther())); - if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - if (src.hasOther()) - tgt.setOther(convertReference(src.getOther())); - if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; - case REPLACES: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACES; - case REFER: return org.hl7.fhir.r5.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.r5.model.Patient.LinkType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; - case REPLACES: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACES; - case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; - } -} - - public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); - if (src.hasRequest()) - tgt.setRequest(convertReference(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasStatusDate()) - tgt.setPaymentDate(src.getStatusDate()); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasTarget()) - tgt.setRecipient(convertReference(src.getTarget())); - if (src.hasProvider()) - tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasOrganization()) -// tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPaymentStatus()) - tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); - if (src.hasRequest()) - tgt.setRequest(convertReference(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasPaymentDate()) - tgt.setStatusDate(src.getPaymentDate()); - if (src.hasCreated()) - tgt.setCreated(src.getCreated()); - if (src.hasRecipient()) - tgt.setTarget(convertReference(src.getRecipient())); - if (src.hasProvider()) - tgt.setProvider(convertReference(src.getProvider())); -// if (src.hasOrganization()) -// tgt.setOrganization(convertReference(src.getOrganization())); - if (src.hasPaymentStatus()) - tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED; - case DRAFT: return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; - case DRAFT: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL; - } -} - - - public static org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasPhoto()) - tgt.setPhoto(convertAttachment(src.getPhoto())); - if (src.hasManagingOrganization()) - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - if (src.hasTarget()) - tgt.setTarget(convertReference(src.getTarget())); - if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; - } -} - - public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - if (src.hasGender()) - tgt.setGender(convertAdministrativeGender(src.getGender())); - if (src.hasBirthDate()) - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIssuer()) - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasIssuer()) - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public static org.hl7.fhir.r5.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PractitionerRole tgt = new org.hl7.fhir.r5.model.PractitionerRole(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasPractitioner()) - tgt.setPractitioner(convertReference(src.getPractitioner())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) - tgt.addHealthcareService(convertReference(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r5.model.PractitionerRole src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole tgt = new org.hl7.fhir.dstu3.model.PractitionerRole(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasPractitioner()) - tgt.setPractitioner(convertReference(src.getPractitioner())); - if (src.hasOrganization()) - tgt.setOrganization(convertReference(src.getOrganization())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) - tgt.addLocation(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) - tgt.addHealthcareService(convertReference(t)); - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); - for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); - if (src.hasAvailabilityExceptions()) - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) - tgt.addEndpoint(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) - copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek2(t.getValue()))); - if (src.hasAllDay()) - tgt.setAllDay(src.getAllDay()); - if (src.hasAvailableStartTime()) - tgt.setAvailableStartTime(src.getAvailableStartTime()); - if (src.hasAvailableEndTime()) - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; - default: return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek convertDaysOfWeek2(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.NULL; - } -} - - public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDuring()) - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - if (src.hasPeriod()) - tgt.setOccurred(convertPeriod(src.getPeriod())); - if (src.hasRecorded()) - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) - tgt.addReason(convertCodingToCodeableConcept(t)); - if (src.hasActivity()) - tgt.setActivity(convertCodingToCodeableConcept(src.getActivity())); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - if (src.hasOccurredPeriod()) - tgt.setPeriod(convertPeriod(src.getOccurredPeriod())); - if (src.hasRecorded()) - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - if (src.hasLocation()) - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) - for (org.hl7.fhir.r5.model.Coding tc : t.getCoding()) - tgt.addReason(convertCoding(tc)); - if (src.hasActivity()) - tgt.setActivity(convertCoding(src.getActivity())); - for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) { - DataType t = convertType(src.getWho()); - if (t instanceof Reference) - tgt.setWho((Reference) t); - if (t instanceof UriType) - tgt.getWho().setReference(t.primitiveValue()); - } - if (src.hasOnBehalfOf()) { - DataType t = convertType(src.getOnBehalfOf()); - if (t instanceof Reference) - tgt.setOnBehalfOf((Reference) t); - if (t instanceof UriType) - tgt.getOnBehalfOf().setReference(t.primitiveValue()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasOnBehalfOf()) - tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhat()) { - DataType t = convertType(src.getWhat()); - if (t instanceof Reference) - tgt.setWhat((Reference) t); - else if (t instanceof Identifier) - tgt.getWhat().setIdentifier((Identifier) t); - else if (t instanceof UriType) - tgt.getWhat().setReference(t.primitiveValue()); - } - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhat()) - tgt.setWhat(convertType(src.getWhat())); - for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; - case REMOVAL: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REMOVAL; - default: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; - case REMOVAL: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REMOVAL; - default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; - } -} - - public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasType()) - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - if (src.hasOptions()) - tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.addInitial().setValue(convertType(src.getInitial())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(t)); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.r5.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasType()) - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - if (src.hasAnswerValueSet()) - tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - if (src.hasInitial()) - tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); - for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; -// case QUESTION: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; -// case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - if (src.hasQuestion()) - tgt.setQuestion(src.getQuestion()); - if (src.hasHasAnswer()) { - tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS); - tgt.setAnswer(convertType(src.getHasAnswerElement())); - } - else if (src.hasAnswer()) { - tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EQUAL); - tgt.setAnswer(convertType(src.getAnswer())); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - if (src.hasQuestion()) - tgt.setQuestion(src.getQuestion()); - if (src.hasOperator() && src.getOperator() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS) - tgt.setHasAnswer(src.getAnswerBooleanType().getValue()); - else if (src.hasAnswer()) - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.addPartOf(convertReference(t)); - if (src.hasQuestionnaire()) - tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); - if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addParent(convertReference(t)); - if (src.hasQuestionnaire()) - tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); - if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - if (src.hasAuthor()) - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasSource()) - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; - default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasText()) - tgt.setText(src.getText()); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasText()) - tgt.setText(src.getText()); -// if (src.hasSubject()) -// tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - - public static org.hl7.fhir.r5.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.RelatedPerson tgt = new org.hl7.fhir.r5.model.RelatedPerson(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - if (src.hasActive()) { - tgt.setActive(src.getActive()); - } - if (src.hasPatient()) { - tgt.setPatient(convertReference(src.getPatient())); - } - if (src.hasRelationship()) { - tgt.addRelationship(convertCodeableConcept(src.getRelationship())); - } - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { - tgt.addName(convertHumanName(t)); - } - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { - tgt.addTelecom(convertContactPoint(t)); - } - if (src.hasGender()) { - tgt.setGender(convertAdministrativeGender(src.getGender())); - } - if (src.hasBirthDate()) { - tgt.setBirthDate(tgt.getBirthDate()); - } - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { - tgt.addAddress(convertAddress(t)); - } - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { - tgt.addPhoto(convertAttachment(t)); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r5.model.RelatedPerson src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); - copyDomainResource(src, tgt); - - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { - tgt.addIdentifier(convertIdentifier(t)); - } - if (src.hasActive()) { - tgt.setActive(src.getActive()); - } - if (src.hasPatient()) { - tgt.setPatient(convertReference(src.getPatient())); - } - List relationships = src.getRelationship(); - if (relationships.size() > 0) { - tgt.setRelationship(convertCodeableConcept(relationships.get(0))); - - if (relationships.size() > 1) { - // TODO print a warning that only one relationship could be converted - } - } - for (org.hl7.fhir.r5.model.HumanName t : src.getName()) { - tgt.addName(convertHumanName(t)); - } - for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) { - tgt.addTelecom(convertContactPoint(t)); - } - if (src.hasGender()) { - tgt.setGender(convertAdministrativeGender(src.getGender())); - } - if (src.hasBirthDate()) { - tgt.setBirthDate(tgt.getBirthDate()); - } - for (org.hl7.fhir.r5.model.Address t : src.getAddress()) { - tgt.addAddress(convertAddress(t)); - } - for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) { - tgt.addPhoto(convertAttachment(t)); - } - if (src.hasPeriod()) { - tgt.setPeriod(convertPeriod(src.getPeriod())); - } - - return tgt; - } - public static org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasBasedOn()) - tgt.setBasedOn(convertReference(src.getBasedOn())); - if (src.hasParent()) - tgt.setParent(convertReference(src.getParent())); - if (src.hasStatus()) - tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasContext()) - tgt.setEncounter(convertReference(src.getContext())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasReason()) { - if (src.getReason() instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - tgt.addReason(convertCodeableConceptToCodableReference((org.hl7.fhir.dstu3.model.CodeableConcept) src.getReason())); - else if (src.getReason() instanceof org.hl7.fhir.dstu3.model.Reference) - tgt.addReason(convertReferenceToCodableReference((org.hl7.fhir.dstu3.model.Reference) src.getReason())); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - if (src.hasMitigation()) - tgt.setMitigation(src.getMitigation()); - if (src.hasComment()) - tgt.addNote().setText(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasBasedOn()) - tgt.setBasedOn(convertReference(src.getBasedOn())); - if (src.hasParent()) - tgt.setParent(convertReference(src.getParent())); - if (src.hasStatus()) - tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasEncounter()) - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasCondition()) - tgt.setCondition(convertReference(src.getCondition())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasReason() && src.getReasonFirstRep().hasConcept()) - tgt.setReason(convertType(src.getReasonFirstRep().getConcept())); - if (src.hasReason() && src.getReasonFirstRep().hasReference()) - tgt.setReason(convertType(src.getReasonFirstRep().getReference())); - for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - if (src.hasMitigation()) - tgt.setMitigation(src.getMitigation()); - if (src.hasNote()) - tgt.setComment(src.getNoteFirstRep().getText()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertRiskAssessmentStatus(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.AMENDED; - case CORRECTED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; - case CANCELLED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasProbability()) - tgt.setProbability(convertType(src.getProbability())); - if (src.hasQualitativeRisk()) - tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); - if (src.hasRelativeRisk()) - tgt.setRelativeRisk(src.getRelativeRisk()); - if (src.hasWhen()) - tgt.setWhen(convertType(src.getWhen())); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - if (src.hasOutcome()) - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - if (src.hasProbability()) - tgt.setProbability(convertType(src.getProbability())); - if (src.hasQualitativeRisk()) - tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); - if (src.hasRelativeRisk()) - tgt.setRelativeRisk(src.getRelativeRisk()); - if (src.hasWhen()) - tgt.setWhen(convertType(src.getWhen())); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) - tgt.addActor(convertReference(t)); - if (src.hasPlanningHorizon()) - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasActive()) - tgt.setActive(src.getActive()); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getActor()) - tgt.addActor(convertReference(t)); - if (src.hasPlanningHorizon()) - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.addBase(t.getValue()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDerivedFrom()) - tgt.setDerivedFrom(src.getDerivedFrom()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getComparator()) - copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getModifier()) - copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); - for (org.hl7.fhir.dstu3.model.StringType t : src.getChain()) - tgt.addChain(t.getValue()); - for (org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) - tgt.addComponent(convertSearchParameterComponentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) - tgt.addBase(t.getValue()); - if (src.hasType()) - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDerivedFrom()) - tgt.setDerivedFrom(src.getDerivedFrom()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getComparator()) - copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); - for (org.hl7.fhir.r5.model.Enumeration t : src.getModifier()) - copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); - for (org.hl7.fhir.r5.model.StringType t : src.getChain()) - tgt.addChain(t.getValue()); - for (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) - tgt.addComponent(convertSearchParameterComponentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; - } -} - - private static org.hl7.fhir.r5.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQ: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EQ; - case NE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NE; - case GT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GT; - case LT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LT; - case GE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GE; - case LE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LE; - case SA: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.SA; - case EB: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EB; - case AP: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.AP; - default: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r5.model.SearchParameter.SearchComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQ: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EQ; - case NE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NE; - case GT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GT; - case LT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LT; - case GE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GE; - case LE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LE; - case SA: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.SA; - case EB: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EB; - case AP: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.AP; - default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NULL; - } -} - - private static org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MISSING: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.MISSING; - case EXACT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.EXACT; - case CONTAINS: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.CONTAINS; - case NOT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOT; - case TEXT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TEXT; - case IN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.IN; - case NOTIN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOTIN; - case BELOW: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.BELOW; - case ABOVE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.ABOVE; - case TYPE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TYPE; - default: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MISSING: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.MISSING; - case EXACT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.EXACT; - case CONTAINS: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.CONTAINS; - case NOT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOT; - case TEXT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TEXT; - case IN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOTIN; - case BELOW: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.BELOW; - case ABOVE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.ABOVE; - case TYPE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TYPE; - default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NULL; - } -} - - public static org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent(); - copyElement(src, tgt); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent(); - copyElement(src, tgt); - if (src.hasDefinition()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MolecularSequence tgt = new org.hl7.fhir.r5.model.MolecularSequence(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.setType(convertSequenceType(src.getType())); - if (src.hasCoordinateSystem()) - tgt.setCoordinateSystem(src.getCoordinateSystem()); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasQuantity()) - tgt.setQuantity(convertQuantity(src.getQuantity())); - if (src.hasReferenceSeq()) - tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant()) - tgt.addVariant(convertSequenceVariantComponent(t)); - if (src.hasObservedSeq()) - tgt.setObservedSeq(src.getObservedSeq()); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality()) - tgt.addQuality(convertSequenceQualityComponent(t)); - if (src.hasReadCoverage()) - tgt.setReadCoverage(src.getReadCoverage()); - for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository()) - tgt.addRepository(convertSequenceRepositoryComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) - tgt.addPointer(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r5.model.MolecularSequence src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.setType(convertSequenceType(src.getType())); - if (src.hasCoordinateSystem()) - tgt.setCoordinateSystem(src.getCoordinateSystem()); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasSpecimen()) - tgt.setSpecimen(convertReference(src.getSpecimen())); - if (src.hasDevice()) - tgt.setDevice(convertReference(src.getDevice())); - if (src.hasPerformer()) - tgt.setPerformer(convertReference(src.getPerformer())); - if (src.hasQuantity()) - tgt.setQuantity(convertQuantity(src.getQuantity())); - if (src.hasReferenceSeq()) - tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); - for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) - tgt.addVariant(convertSequenceVariantComponent(t)); - if (src.hasObservedSeq()) - tgt.setObservedSeq(src.getObservedSeq()); - for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) - tgt.addQuality(convertSequenceQualityComponent(t)); - if (src.hasReadCoverage()) - tgt.setReadCoverage(src.getReadCoverage()); - for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) - tgt.addRepository(convertSequenceRepositoryComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPointer()) - tgt.addPointer(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.dstu3.model.Sequence.SequenceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.AA; - case DNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.DNA; - case RNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.RNA; - default: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.SequenceType convertSequenceType(org.hl7.fhir.r5.model.MolecularSequence.SequenceType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA; - case DNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA; - case RNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA; - default: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL; - } -} - - public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); - copyElement(src, tgt); - if (src.hasChromosome()) - tgt.setChromosome(convertCodeableConcept(src.getChromosome())); - if (src.hasGenomeBuild()) - tgt.setGenomeBuild(src.getGenomeBuild()); - if (src.hasReferenceSeqId()) - tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); - if (src.hasReferenceSeqPointer()) - tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); - if (src.hasReferenceSeqString()) - tgt.setReferenceSeqString(src.getReferenceSeqString()); -// if (src.hasStrand()) -// tgt.setStrand(src.getStrand()); - if (src.hasWindowStart()) - tgt.setWindowStart(src.getWindowStart()); - if (src.hasWindowEnd()) - tgt.setWindowEnd(src.getWindowEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent(); - copyElement(src, tgt); - if (src.hasChromosome()) - tgt.setChromosome(convertCodeableConcept(src.getChromosome())); - if (src.hasGenomeBuild()) - tgt.setGenomeBuild(src.getGenomeBuild()); - if (src.hasReferenceSeqId()) - tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); - if (src.hasReferenceSeqPointer()) - tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); - if (src.hasReferenceSeqString()) - tgt.setReferenceSeqString(src.getReferenceSeqString()); -// if (src.hasStrand()) -// tgt.setStrand(src.getStrand()); - if (src.hasWindowStart()) - tgt.setWindowStart(src.getWindowStart()); - if (src.hasWindowEnd()) - tgt.setWindowEnd(src.getWindowEnd()); - return tgt; - } - - public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasObservedAllele()) - tgt.setObservedAllele(src.getObservedAllele()); - if (src.hasReferenceAllele()) - tgt.setReferenceAllele(src.getReferenceAllele()); - if (src.hasCigar()) - tgt.setCigar(src.getCigar()); - if (src.hasVariantPointer()) - tgt.setVariantPointer(convertReference(src.getVariantPointer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasObservedAllele()) - tgt.setObservedAllele(src.getObservedAllele()); - if (src.hasReferenceAllele()) - tgt.setReferenceAllele(src.getReferenceAllele()); - if (src.hasCigar()) - tgt.setCigar(src.getCigar()); - if (src.hasVariantPointer()) - tgt.setVariantPointer(convertReference(src.getVariantPointer())); - return tgt; - } - - public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertQualityType(src.getType())); - if (src.hasStandardSequence()) - tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasScore()) - tgt.setScore(convertQuantity(src.getScore())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasTruthTP()) - tgt.setTruthTP(src.getTruthTP()); - if (src.hasQueryTP()) - tgt.setQueryTP(src.getQueryTP()); - if (src.hasTruthFN()) - tgt.setTruthFN(src.getTruthFN()); - if (src.hasQueryFP()) - tgt.setQueryFP(src.getQueryFP()); - if (src.hasGtFP()) - tgt.setGtFP(src.getGtFP()); - if (src.hasPrecision()) - tgt.setPrecision(src.getPrecision()); - if (src.hasRecall()) - tgt.setRecall(src.getRecall()); - if (src.hasFScore()) - tgt.setFScore(src.getFScore()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertQualityType(src.getType())); - if (src.hasStandardSequence()) - tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasScore()) - tgt.setScore(convertQuantity(src.getScore())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasTruthTP()) - tgt.setTruthTP(src.getTruthTP()); - if (src.hasQueryTP()) - tgt.setQueryTP(src.getQueryTP()); - if (src.hasTruthFN()) - tgt.setTruthFN(src.getTruthFN()); - if (src.hasQueryFP()) - tgt.setQueryFP(src.getQueryFP()); - if (src.hasGtFP()) - tgt.setGtFP(src.getGtFP()); - if (src.hasPrecision()) - tgt.setPrecision(src.getPrecision()); - if (src.hasRecall()) - tgt.setRecall(src.getRecall()); - if (src.hasFScore()) - tgt.setFScore(src.getFScore()); - return tgt; - } - - private static org.hl7.fhir.r5.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.dstu3.model.Sequence.QualityType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INDEL: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.INDEL; - case SNP: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.SNP; - case UNKNOWN: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.UNKNOWN; - default: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.QualityType convertQualityType(org.hl7.fhir.r5.model.MolecularSequence.QualityType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INDEL: return org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL; - case SNP: return org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL; - } -} - - public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRepositoryType(src.getType())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDatasetId()) - tgt.setDatasetId(src.getDatasetId()); - if (src.hasVariantsetId()) - tgt.setVariantsetId(src.getVariantsetId()); - if (src.hasReadsetId()) - tgt.setReadsetId(src.getReadsetId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertRepositoryType(src.getType())); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDatasetId()) - tgt.setDatasetId(src.getDatasetId()); - if (src.hasVariantsetId()) - tgt.setVariantsetId(src.getVariantsetId()); - if (src.hasReadsetId()) - tgt.setReadsetId(src.getReadsetId()); - return tgt; - } - - private static org.hl7.fhir.r5.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.dstu3.model.Sequence.RepositoryType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DIRECTLINK: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.DIRECTLINK; - case OPENAPI: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OPENAPI; - case LOGIN: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.LOGIN; - case OAUTH: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OAUTH; - case OTHER: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OTHER; - default: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Sequence.RepositoryType convertRepositoryType(org.hl7.fhir.r5.model.MolecularSequence.RepositoryType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DIRECTLINK: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK; - case OPENAPI: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI; - case LOGIN: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN; - case OAUTH: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH; - case OTHER: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER; - default: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL; - } -} - - public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasServiceCategory()) - tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - if (src.hasSchedule()) - tgt.setSchedule(convertReference(src.getSchedule())); - if (src.hasStatus()) - tgt.setStatus(convertSlotStatus(src.getStatus())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasOverbooked()) - tgt.setOverbooked(src.getOverbooked()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasServiceCategory()) - tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) - tgt.addServiceType(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(t)); - if (src.hasAppointmentType()) - tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); - if (src.hasSchedule()) - tgt.setSchedule(convertReference(src.getSchedule())); - if (src.hasStatus()) - tgt.setStatus(convertSlotStatus(src.getStatus())); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - if (src.hasOverbooked()) - tgt.setOverbooked(src.getOverbooked()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Slot.SlotStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Specimen convertSpecimen(org.hl7.fhir.dstu3.model.Specimen src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Specimen tgt = new org.hl7.fhir.r5.model.Specimen(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAccessionIdentifier()) - tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertSpecimenStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasReceivedTime()) - tgt.setReceivedTime(src.getReceivedTime()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) - tgt.addParent(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) - tgt.addRequest(convertReference(t)); - if (src.hasCollection()) - tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) - tgt.addProcessing(convertSpecimenProcessingComponent(t)); - for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) - tgt.addContainer(convertSpecimenContainerComponent(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen convertSpecimen(org.hl7.fhir.r5.model.Specimen src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen tgt = new org.hl7.fhir.dstu3.model.Specimen(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasAccessionIdentifier()) - tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); - if (src.hasStatus()) - tgt.setStatus(convertSpecimenStatus(src.getStatus())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSubject()) - tgt.setSubject(convertReference(src.getSubject())); - if (src.hasReceivedTime()) - tgt.setReceivedTime(src.getReceivedTime()); - for (org.hl7.fhir.r5.model.Reference t : src.getParent()) - tgt.addParent(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) - tgt.addRequest(convertReference(t)); - if (src.hasCollection()) - tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); - for (org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) - tgt.addProcessing(convertSpecimenProcessingComponent(t)); - for (org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent t : src.getContainer()) - tgt.addContainer(convertSpecimenContainerComponent(t)); - for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.AVAILABLE; - case UNAVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNAVAILABLE; - case UNSATISFACTORY: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNSATISFACTORY; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r5.model.Specimen.SpecimenStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.AVAILABLE; - case UNAVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNAVAILABLE; - case UNSATISFACTORY: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNSATISFACTORY; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent(); - copyElement(src, tgt); - if (src.hasCollector()) - tgt.setCollector(convertReference(src.getCollector())); - if (src.hasCollected()) - tgt.setCollected(convertType(src.getCollected())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent(); - copyElement(src, tgt); - if (src.hasCollector()) - tgt.setCollector(convertReference(src.getCollector())); - if (src.hasCollected()) - tgt.setCollected(convertType(src.getCollected())); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasBodySite()) - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasProcedure()) - tgt.setProcedure(convertCodeableConcept(src.getProcedure())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) - tgt.addAdditive(convertReference(t)); - if (src.hasTime()) - tgt.setTime(convertType(src.getTime())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasProcedure()) - tgt.setProcedure(convertCodeableConcept(src.getProcedure())); - for (org.hl7.fhir.r5.model.Reference t : src.getAdditive()) - tgt.addAdditive(convertReference(t)); - if (src.hasTime()) - tgt.setTime(convertType(src.getTime())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCapacity()) - tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); - if (src.hasSpecimenQuantity()) - tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); - if (src.hasAdditive()) - tgt.setAdditive(convertType(src.getAdditive())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasCapacity()) - tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); - if (src.hasSpecimenQuantity()) - tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); - if (src.hasAdditive()) - tgt.setAdditive(convertType(src.getAdditive())); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) { - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); - ec.setType(convertExtensionContext(src.getContextType())); - ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); - } - for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) - tgt.addContextInvariant(t.getValue()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasDerivation()) - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - if (src.hasDifferential()) - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) { - for (org.hl7.fhir.r5.model.ElementDefinition ed : tgt.getSnapshot().getElement()) { - if (!ed.hasBase()) { - ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + if (src instanceof org.hl7.fhir.r5.model.ActivityDefinition) + return ActivityDefinition30_50.convertActivityDefinition((org.hl7.fhir.r5.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.AllergyIntolerance) + return AllergyIntolerance30_50.convertAllergyIntolerance((org.hl7.fhir.r5.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.r5.model.Appointment) + return Appointment30_50.convertAppointment((org.hl7.fhir.r5.model.Appointment) src); + if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) + return AppointmentResponse30_50.convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.AuditEvent) + return AuditEvent30_50.convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r5.model.Basic) + return Basic30_50.convertBasic((org.hl7.fhir.r5.model.Basic) src); + if (src instanceof org.hl7.fhir.r5.model.Binary) + return Binary30_50.convertBinary((org.hl7.fhir.r5.model.Binary) src); + if (src instanceof org.hl7.fhir.r5.model.BodyStructure) + return BodySite30_50.convertBodySite((org.hl7.fhir.r5.model.BodyStructure) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return Bundle30_50.convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return CapabilityStatement30_50.convertCapabilityStatement((org.hl7.fhir.r5.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r5.model.CarePlan) + return CarePlan30_50.convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r5.model.CareTeam) + return CareTeam30_50.convertCareTeam((org.hl7.fhir.r5.model.CareTeam) src); + if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) + return ClinicalImpression30_50.convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r5.model.CodeSystem) + return CodeSystem30_50.convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Communication) + return Communication30_50.convertCommunication((org.hl7.fhir.r5.model.Communication) src); + if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) + return CompartmentDefinition30_50.convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Composition) + return Composition30_50.convertComposition((org.hl7.fhir.r5.model.Composition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return ConceptMap30_50.convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.Condition) + return Condition30_50.convertCondition((org.hl7.fhir.r5.model.Condition) src); + if (src instanceof org.hl7.fhir.r5.model.Consent) + return Consent30_50.convertConsent((org.hl7.fhir.r5.model.Consent) src); + if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) + return DetectedIssue30_50.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) + return DeviceUseStatement30_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) + return DiagnosticReport30_50.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return DocumentReference30_50.convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.Encounter) + return Encounter30_50.convertEncounter((org.hl7.fhir.r5.model.Encounter) src); + if (src instanceof org.hl7.fhir.r5.model.Endpoint) + return Endpoint30_50.convertEndpoint((org.hl7.fhir.r5.model.Endpoint) src); + if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) + return EpisodeOfCare30_50.convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) + return FamilyMemberHistory30_50.convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r5.model.Flag) + return Flag30_50.convertFlag((org.hl7.fhir.r5.model.Flag) src); + if (src instanceof org.hl7.fhir.r5.model.Goal) + return Goal30_50.convertGoal((org.hl7.fhir.r5.model.Goal) src); + if (src instanceof org.hl7.fhir.r5.model.GraphDefinition) + return GraphDefinition30_50.convertGraphDefinition((org.hl7.fhir.r5.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Group) + return Group30_50.convertGroup((org.hl7.fhir.r5.model.Group) src); + if (src instanceof org.hl7.fhir.r5.model.HealthcareService) + return HealthcareService30_50.convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r5.model.ImagingStudy) + return ImagingStudy30_50.convertImagingStudy((org.hl7.fhir.r5.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.r5.model.Immunization) + return Immunization30_50.convertImmunization((org.hl7.fhir.r5.model.Immunization) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return ImplementationGuide30_50.convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.Library) + return Library30_50.convertLibrary((org.hl7.fhir.r5.model.Library) src); + if (src instanceof org.hl7.fhir.r5.model.Linkage) + return Linkage30_50.convertLinkage((org.hl7.fhir.r5.model.Linkage) src); + if (src instanceof org.hl7.fhir.r5.model.ListResource) + return List30_50.convertList((org.hl7.fhir.r5.model.ListResource) src); + if (src instanceof org.hl7.fhir.r5.model.Location) + return Location30_50.convertLocation((org.hl7.fhir.r5.model.Location) src); + if (src instanceof org.hl7.fhir.r5.model.Measure) + return Measure30_50.convertMeasure((org.hl7.fhir.r5.model.Measure) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return Media30_50.convertMedia((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.Medication) + return Medication30_50.convertMedication((org.hl7.fhir.r5.model.Medication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationAdministration) + return MedicationAdministration30_50.convertMedicationAdministration((org.hl7.fhir.r5.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) + return MedicationDispense30_50.convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationRequest) + return MedicationRequest30_50.convertMedicationRequest((org.hl7.fhir.r5.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationUsage) + return MedicationStatement30_50.convertMedicationStatement((org.hl7.fhir.r5.model.MedicationUsage) src); + if (src instanceof org.hl7.fhir.r5.model.MessageDefinition) + return MessageDefinition30_50.convertMessageDefinition((org.hl7.fhir.r5.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.MessageHeader) + return MessageHeader30_50.convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return NamingSystem30_50.convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Observation) + return Observation30_50.convertObservation((org.hl7.fhir.r5.model.Observation) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return OperationDefinition30_50.convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return OperationOutcome30_50.convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Organization) + return Organization30_50.convertOrganization((org.hl7.fhir.r5.model.Organization) src); + if (src instanceof org.hl7.fhir.r5.model.Patient) + return Patient30_50.convertPatient((org.hl7.fhir.r5.model.Patient) src); + if (src instanceof org.hl7.fhir.r5.model.PaymentNotice) + return PaymentNotice30_50.convertPaymentNotice((org.hl7.fhir.r5.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.r5.model.Person) + return Person30_50.convertPerson((org.hl7.fhir.r5.model.Person) src); + if (src instanceof org.hl7.fhir.r5.model.PlanDefinition) + return PlanDefinition30_50.convertPlanDefinition((org.hl7.fhir.r5.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Practitioner) + return Practitioner30_50.convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r5.model.PractitionerRole) + return PractitionerRole30_50.convertPractitionerRole((org.hl7.fhir.r5.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return Questionnaire30_50.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return QuestionnaireResponse30_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.RelatedPerson) + return RelatedPerson30_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) + return RiskAssessment30_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r5.model.Schedule) + return Schedule30_50.convertSchedule((org.hl7.fhir.r5.model.Schedule) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return SearchParameter30_50.convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.MolecularSequence) + return Sequence30_50.convertSequence((org.hl7.fhir.r5.model.MolecularSequence) src); + if (src instanceof org.hl7.fhir.r5.model.Slot) + return Slot30_50.convertSlot((org.hl7.fhir.r5.model.Slot) src); + if (src instanceof org.hl7.fhir.r5.model.Specimen) + return Specimen30_50.convertSpecimen((org.hl7.fhir.r5.model.Specimen) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return StructureDefinition30_50.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureMap) + return StructureMap30_50.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r5.model.Substance) + return Substance30_50.convertSubstance((org.hl7.fhir.r5.model.Substance) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) + return SupplyDelivery30_50.convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r5.model.TestReport) + return TestReport30_50.convertTestReport((org.hl7.fhir.r5.model.TestReport) src); + if (src instanceof org.hl7.fhir.r5.model.TestScript) + return TestScript30_50.convertTestScript((org.hl7.fhir.r5.model.TestScript) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return ValueSet30_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); + if (!nullOk) + throw new FHIRException("Unknown resource " + src.fhirType()); + else + return null; + } + + public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src, boolean b) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); } - } + return res; } - return tgt; - } - public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion().toCode()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { - if (!tgt.hasContextType()) - tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); - tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ClinicalImpression", "CodeSystem", "Communication", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "DetectedIssue", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "Endpoint", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImplementationGuide", "Library", "Linkage", "ListResource", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "PaymentNotice", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "ProcessRequest", "Questionnaire", "QuestionnaireResponse", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "TestReport", "TestScript", "ValueSet"); } - for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) - tgt.addContextInvariant(t.getValue()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasDerivation()) - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - if (src.hasDifferential()) - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - case COMPLEXTYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; - } -} - - private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; - case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; - default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case ELEMENT: - String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; - if (isResource300(tn)) { - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - } else { - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - } - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static boolean isResource300(String tn) { - return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", - "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", - "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", - "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", - "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", - "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", - "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", - "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", - "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", - "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", - "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription"); - } - - private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - if (src.hasIdentity()) - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu3.model.StructureMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap tgt = new org.hl7.fhir.dstu3.model.StructureMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) - tgt.addStructure(convertStructureMapStructureComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getImport()) - tgt.addImport(t.getValue()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) - tgt.addGroup(convertStructureMapGroupComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasMode()) - tgt.setMode(convertStructureMapModelMode(src.getMode())); - if (src.hasAlias()) - tgt.setAlias(src.getAlias()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasMode()) - tgt.setMode(convertStructureMapModelMode(src.getMode())); - if (src.hasAlias()) - tgt.setAlias(src.getAlias()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; - case QUERIED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; - case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; - case PRODUCED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.SOURCE; - case QUERIED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.QUERIED; - case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.TARGET; - case PRODUCED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.PRODUCED; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (src.hasTypeMode()) - tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasExtends()) - tgt.setExtends(src.getExtends()); - if (src.hasTypeMode()) - tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) - tgt.addInput(convertStructureMapGroupInputComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE; - case TYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPES; - case TYPEANDTYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NONE; - case TYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPES; - case TYPEANDTYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasMode()) - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasMode()) - tgt.setMode(convertStructureMapInputMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.SOURCE; - case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.TARGET; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) - tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) - tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) - tgt.addRule(convertStructureMapGroupRuleComponent(t)); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) - tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasListMode()) - tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - if (src.hasCondition()) - tgt.setCondition(src.getCondition()); - if (src.hasCheck()) - tgt.setCheck(src.getCheck()); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; - case NOTFIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTFIRST; - case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; - case NOTLAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTLAST; - case ONLYONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.ONLYONE; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.FIRST; - case NOTFIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTFIRST; - case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.LAST; - case NOTLAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTLAST; - case ONLYONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.ONLYONE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent(); - copyElement(src, tgt); - if (src.hasContext()) - tgt.setContext(src.getContext()); - if (src.hasContextType()) - tgt.setContextType(convertStructureMapContextType(src.getContextType())); - if (src.hasElement()) - tgt.setElement(src.getElement()); - if (src.hasVariable()) - tgt.setVariable(src.getVariable()); - for (org.hl7.fhir.r5.model.Enumeration t : src.getListMode()) - copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); - if (src.hasListRuleId()) - tgt.setListRuleId(src.getListRuleId()); - if (src.hasTransform()) - tgt.setTransform(convertStructureMapTransform(src.getTransform())); - for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) - tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TYPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE; - case VARIABLE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL; - } -} - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; - case SHARE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; - case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; - case COLLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.COLLATE; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.FIRST; - case SHARE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.SHARE; - case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.LAST; - case COLLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.COLLATE; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.NULL; - } -} - - private static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CREATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; - case COPY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; - case TRUNCATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; - case ESCAPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; - case CAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; - case APPEND: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; - case TRANSLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; - case REFERENCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; - case DATEOP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; - case UUID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; - case POINTER: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; - case EVALUATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; - case CC: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CC; - case C: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.C; - case QTY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.QTY; - case ID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ID; - case CP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CP; - default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CREATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CREATE; - case COPY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.COPY; - case TRUNCATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRUNCATE; - case ESCAPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ESCAPE; - case CAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CAST; - case APPEND: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.APPEND; - case TRANSLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRANSLATE; - case REFERENCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.REFERENCE; - case DATEOP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.DATEOP; - case UUID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.UUID; - case POINTER: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.POINTER; - case EVALUATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.EVALUATE; - case CC: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CC; - case C: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.C; - case QTY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.QTY; - case ID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ID; - case CP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CP; - default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.NULL; - } -} - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getVariable()) - tgt.addVariable(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) - tgt.addVariable(t.getValue()); - return tgt; - } - -// public static org.hl7.fhir.r5.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Subscription tgt = new org.hl7.fhir.r5.model.Subscription(); -// copyDomainResource(src, tgt); -// if (src.hasStatus()) -// tgt.setStatus(convertSubscriptionStatus(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasEnd()) -// tgt.setEnd(src.getEnd()); -// if (src.hasReason()) -// tgt.setReason(src.getReason()); -// if (src.hasCriteria()) -// tgt.setCriteria(src.getCriteria()); -// if (src.hasError()) -// tgt.setError(src.getError()); -// if (src.hasChannel()) -// tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.r5.model.Subscription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); -// copyDomainResource(src, tgt); -// if (src.hasStatus()) -// tgt.setStatus(convertSubscriptionStatus(src.getStatus())); -// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) -// tgt.addContact(convertContactPoint(t)); -// if (src.hasEnd()) -// tgt.setEnd(src.getEnd()); -// if (src.hasReason()) -// tgt.setReason(src.getReason()); -// if (src.hasCriteria()) -// tgt.setCriteria(src.getCriteria()); -// if (src.hasError()) -// tgt.setError(src.getError()); -// if (src.hasChannel()) -// tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case REQUESTED: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ACTIVE; -// case ERROR: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ERROR; -// case OFF: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.OFF; -// default: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r5.model.Subscription.SubscriptionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; -// case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; -// case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; -// case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; -// default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertSubscriptionChannelType(src.getType())); -// if (src.hasEndpoint()) -// tgt.setEndpoint(src.getEndpoint()); -// if (src.hasPayload()) -// tgt.setPayload(src.getPayload()); -// for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) -// tgt.addHeader(t.getValue()); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); -// copyElement(src, tgt); -// if (src.hasType()) -// tgt.setType(convertSubscriptionChannelType(src.getType())); -// if (src.hasEndpoint()) -// tgt.setEndpoint(src.getEndpoint()); -// if (src.hasPayload()) -// tgt.setPayload(src.getPayload()); -// for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) -// tgt.addHeader(t.getValue()); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RESTHOOK: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.RESTHOOK; -// case WEBSOCKET: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.WEBSOCKET; -// case EMAIL: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.EMAIL; -// case SMS: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.SMS; -// case MESSAGE: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.MESSAGE; -// default: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; -// case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; -// case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; -// case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; -// case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; -// default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; -// } -//} -// - public static org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasStatus()) - tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExpiry()) - tgt.setExpiry(src.getExpiry()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExpiry()) - tgt.setExpiry(src.getExpiry()); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public static org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertRatio(src.getQuantity())); - if (src.hasSubstance()) - tgt.setSubstance(convertType(src.getSubstance())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertRatio(src.getQuantity())); - if (src.hasSubstance()) - tgt.setSubstance(convertType(src.getSubstance())); - return tgt; - } - - public static org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSuppliedItem()) - tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasSupplier()) - tgt.setSupplier(convertReference(src.getSupplier())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) - tgt.addBasedOn(convertReference(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) - tgt.addPartOf(convertReference(t)); - if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - if (src.hasPatient()) - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSuppliedItem()) - tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); - if (src.hasOccurrence()) - tgt.setOccurrence(convertType(src.getOccurrence())); - if (src.hasSupplier()) - tgt.setSupplier(convertReference(src.getSupplier())); - if (src.hasDestination()) - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } -} - - public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); - copyElement(src, tgt); - if (src.hasQuantity()) - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - if (src.hasItem()) - tgt.setItem(convertType(src.getItem())); - return tgt; - } - - - public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.dstu3.model.TestReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertTestReportStatus(src.getStatus())); - if (src.hasTestScript()) - tgt.setTestScript(convertReference(src.getTestScript())); - if (src.hasResult()) - tgt.setResult(convertTestReportResult(src.getResult())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - if (src.hasTester()) - tgt.setTester(src.getTester()); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertTestReportParticipantComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent t : src.getTest()) - tgt.addTest(convertTestReportTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport tgt = new org.hl7.fhir.dstu3.model.TestReport(); - copyDomainResource(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasStatus()) - tgt.setStatus(convertTestReportStatus(src.getStatus())); - if (src.hasTestScript()) - tgt.setTestScript(convertReference(src.getTestScript())); - if (src.hasResult()) - tgt.setResult(convertTestReportResult(src.getResult())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - if (src.hasTester()) - tgt.setTester(src.getTester()); - if (src.hasIssued()) - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertTestReportParticipantComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); - for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest()) - tgt.addTest(convertTestReportTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); - return tgt; - } - - private static org.hl7.fhir.r5.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.dstu3.model.TestReport.TestReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED; - case INPROGRESS: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS; - case WAITING: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING; - case STOPPED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED; - case ENTEREDINERROR: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r5.model.TestReport.TestReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPLETED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.COMPLETED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.INPROGRESS; - case WAITING: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.WAITING; - case STOPPED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.STOPPED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.NULL; - } -} - - private static org.hl7.fhir.r5.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.dstu3.model.TestReport.TestReportResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS; - case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL; - case PENDING: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING; - default: return org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r5.model.TestReport.TestReportResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PASS; - case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.FAIL; - case PENDING: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PENDING; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.NULL; - } -} - - public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTestReportParticipantType(src.getType())); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertTestReportParticipantType(src.getType())); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - private static org.hl7.fhir.r5.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TESTENGINE: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE; - case CLIENT: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT; - case SERVER: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER; - default: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TESTENGINE: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.TESTENGINE; - case CLIENT: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.SERVER; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.NULL; - } -} - - public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - private static org.hl7.fhir.r5.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS; - case SKIP: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP; - case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL; - case WARNING: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING; - case ERROR: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR; - default: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r5.model.TestReport.TestReportActionResult src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.PASS; - case SKIP: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.SKIP; - case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.FAIL; - case WARNING: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.WARNING; - case ERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.ERROR; - default: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.NULL; - } -} - - public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasResult()) - tgt.setResult(convertTestReportActionResult(src.getResult())); - if (src.hasMessage()) - tgt.setMessage(src.getMessage()); - if (src.hasDetail()) - tgt.setDetail(src.getDetail()); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestReport.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestReport.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - if (src.hasMetadata()) - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - if (src.hasMetadata()) - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - if (src.hasSetup()) - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - if (src.hasTeardown()) - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - if (src.hasIndex()) - tgt.setIndex(src.getIndex()); - if (src.hasProfile()) - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - if (src.hasCapabilities()) - tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getCapabilities())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.r5.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - if (src.hasCapabilities()) - tgt.setCapabilities(convertCanonicalToReference(src.getCapabilitiesElement())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasHint()) - tgt.setHint(src.getHint()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasHint()) - tgt.setHint(src.getHint()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(org.hl7.fhir.r5.model.TestScript.FHIRDefinedType.fromCode(src.getResource())); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasRequestId()) - tgt.setRequestId(src.getRequestId()); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(src.getResource().toCode()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasRequestId()) - tgt.setRequestId(src.getRequestId()); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static String convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return "application/fhir+xml"; - case JSON: return "application/fhir+json"; - case TTL: return "text/turtle"; - case NONE: return null; - default: return null; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(String src) throws FHIRException { - if (src == null) - return null; - if (src.contains("xml")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - if (src.contains("json")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - if (src.contains("tu")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.TTL; - return org.hl7.fhir.dstu3.model.TestScript.ContentType.NONE; - } - - - public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - if (src.hasField()) - tgt.setField(src.getField()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - if (src.hasField()) - tgt.setField(src.getField()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourceExpression()) - tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasRequestMethod()) - tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); - if (src.hasRequestURL()) - tgt.setRequestURL(src.getRequestURL()); - if (src.hasResource()) - tgt.setResource(org.hl7.fhir.r5.model.TestScript.FHIRDefinedType.fromCode(src.getResource())); - if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourceExpression()) - tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasRequestMethod()) - tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); - if (src.hasRequestURL()) - tgt.setRequestURL(src.getRequestURL()); - if (src.hasResource()) - tgt.setResource(src.getResource().toCode()); - if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - private static org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; - } -} - - private static org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; - case EVAL: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EVAL; - default: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - case EVAL: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EVAL; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; - } -} - - private static org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DELETE: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.DELETE; - case GET: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.GET; - case OPTIONS: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.OPTIONS; - case PATCH: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PATCH; - case POST: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.POST; - case PUT: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PUT; - default: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DELETE: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.DELETE; - case GET: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.GET; - case OPTIONS: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.OPTIONS; - case PATCH: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PATCH; - case POST: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.POST; - case PUT: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PUT; - default: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.NULL; - } -} - - private static org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - if (src.hasAssert()) - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - if (src.hasOperation()) - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/StructureDefinition/valueset-extensible"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); - if (src.hasCompose()) - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt, "http://hl7.org/fhir/StructureDefinition/valueset-extensible"); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - 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.hasCompose()) - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - if (src.hasLockedDate()) - tgt.setLockedDate(src.getLockedDate()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - if (src.hasLockedDate()) - tgt.setLockedDate(src.getLockedDate()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getValueSet()) - tgt.addValueSet(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - for (org.hl7.fhir.r5.model.UriType t : src.getValueSet()) - tgt.addValueSet(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - 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; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasUse()) - tgt.setUse(convertCoding(src.getUse())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasOp()) - tgt.setOp(convertFilterOperator(src.getOp())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - if (src.hasProperty()) - tgt.setProperty(src.getProperty()); - if (src.hasOp()) - tgt.setOp(convertFilterOperator2(src.getOp())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS; - default: return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator2(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case DESCENDENTOF: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.DESCENDENTOF; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - case GENERALIZES: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.GENERALIZES; - case EXISTS: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EXISTS; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; - } -} - - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasTimestamp()) - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - if (src.hasIdentifier()) - tgt.setIdentifier(src.getIdentifier()); - if (src.hasTimestamp()) - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasInactive()) - tgt.setInactive(src.getInactive()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - -// public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu3.model.VisionPrescription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.VisionPrescription tgt = new org.hl7.fhir.r5.model.VisionPrescription(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertVisionStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// if (src.hasPrescriber()) -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReason()) -// tgt.setReason(convertType(src.getReason())); -// for (org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) -// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r5.model.VisionPrescription src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// if (src.hasStatus()) -// tgt.setStatus(convertVisionStatus(src.getStatus())); -// if (src.hasPatient()) -// tgt.setPatient(convertReference(src.getPatient())); -// if (src.hasEncounter()) -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// if (src.hasPrescriber()) -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReason()) -// tgt.setReason(convertType(src.getReason())); -// for (org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) -// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.r5.model.VisionPrescription.VisionStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ACTIVE; -// case CANCELLED: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.CANCELLED; -// case DRAFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.DRAFT; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ENTEREDINERROR; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.NULL; -// } -//} -// -// public static org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent(); -// copyElement(src, tgt); -// if (src.hasProduct()) -// tgt.setProduct(convertCodeableConcept(src.getProduct())); -// if (src.hasEye()) -// tgt.setEye(convertVisionEyes(src.getEye())); -// if (src.hasSphere()) -// tgt.setSphere(src.getSphere()); -// if (src.hasCylinder()) -// tgt.setCylinder(src.getCylinder()); -// if (src.hasAxis()) -// tgt.setAxis(src.getAxis()); -// if (src.hasPrism()) -// tgt.setPrism(src.getPrism()); -// if (src.hasBase()) -// tgt.setBase(convertVisionBase(src.getBase())); -// if (src.hasAdd()) -// tgt.setAdd(src.getAdd()); -// if (src.hasPower()) -// tgt.setPower(src.getPower()); -// if (src.hasBackCurve()) -// tgt.setBackCurve(src.getBackCurve()); -// if (src.hasDiameter()) -// tgt.setDiameter(src.getDiameter()); -// if (src.hasDuration()) -// tgt.setDuration(convertSimpleQuantity(src.getDuration())); -// if (src.hasColor()) -// tgt.setColor(src.getColor()); -// if (src.hasBrand()) -// tgt.setBrand(src.getBrand()); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// public static org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { -// if (src == null) -// return null; -// org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent(); -// copyElement(src, tgt); -// if (src.hasProduct()) -// tgt.setProduct(convertCodeableConcept(src.getProduct())); -// if (src.hasEye()) -// tgt.setEye(convertVisionEyes(src.getEye())); -// if (src.hasSphere()) -// tgt.setSphere(src.getSphere()); -// if (src.hasCylinder()) -// tgt.setCylinder(src.getCylinder()); -// if (src.hasAxis()) -// tgt.setAxis(src.getAxis()); -// if (src.hasPrism()) -// tgt.setPrism(src.getPrism()); -// if (src.hasBase()) -// tgt.setBase(convertVisionBase(src.getBase())); -// if (src.hasAdd()) -// tgt.setAdd(src.getAdd()); -// if (src.hasPower()) -// tgt.setPower(src.getPower()); -// if (src.hasBackCurve()) -// tgt.setBackCurve(src.getBackCurve()); -// if (src.hasDiameter()) -// tgt.setDiameter(src.getDiameter()); -// if (src.hasDuration()) -// tgt.setDuration(convertSimpleQuantity(src.getDuration())); -// if (src.hasColor()) -// tgt.setColor(src.getColor()); -// if (src.hasBrand()) -// tgt.setBrand(src.getBrand()); -// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) -// tgt.addNote(convertAnnotation(t)); -// return tgt; -// } -// -// private static org.hl7.fhir.r5.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RIGHT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.RIGHT; -// case LEFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.LEFT; -// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r5.model.VisionPrescription.VisionEyes src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case RIGHT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.RIGHT; -// case LEFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.LEFT; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.NULL; -// } -//} -// -// private static org.hl7.fhir.r5.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UP: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.UP; -// case DOWN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.DOWN; -// case IN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.IN; -// case OUT: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.OUT; -// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.NULL; -// } -//} -// -// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r5.model.VisionPrescription.VisionBase src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case UP: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.UP; -// case DOWN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.DOWN; -// case IN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.IN; -// case OUT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.OUT; -// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.NULL; -// } -//} - - public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) - tgt.getLibrary().add(convertReferenceToCanonical(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) - tgt.addGoal(convertPlanDefinitionGoalComponent(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) - tgt.addLibrary(convertCanonicalToReference(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) - tgt.addGoal(convertPlanDefinitionGoalComponent(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent(); - copyElement(src, tgt); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasStart()) - tgt.setStart(convertCodeableConcept(src.getStart())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses()) - tgt.addAddresses(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) - tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent(); - copyElement(src, tgt); - if (src.hasCategory()) - tgt.setCategory(convertCodeableConcept(src.getCategory())); - if (src.hasDescription()) - tgt.setDescription(convertCodeableConcept(src.getDescription())); - if (src.hasPriority()) - tgt.setPriority(convertCodeableConcept(src.getPriority())); - if (src.hasStart()) - tgt.setStart(convertCodeableConcept(src.getStart())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses()) - tgt.addAddresses(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) - tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertDuration(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); - copyElement(src, tgt); - if (src.hasMeasure()) - tgt.setMeasure(convertCodeableConcept(src.getMeasure())); - if (src.hasDetail()) - tgt.setDetail(convertType(src.getDetail())); - if (src.hasDue()) - tgt.setDue(convertDuration(src.getDue())); - return tgt; - } - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setPrefix(src.getLabel()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasTextEquivalent()) - tgt.setTextEquivalent(src.getTextEquivalent()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) - tgt.addGoalId(t.getValue()); - for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) - tgt.addTrigger(convertTriggerDefinition(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) - tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) - tgt.addInput(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) - tgt.addOutput(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) - tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); - if (src.hasType()) - tgt.getType().addCoding(convertCoding(src.getType())); - if (src.hasGroupingBehavior()) - tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); - if (src.hasSelectionBehavior()) - tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); - if (src.hasRequiredBehavior()) - tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); - if (src.hasPrecheckBehavior()) - tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); - if (src.hasCardinalityBehavior()) - tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); - if (src.hasDefinition()) - tgt.setDefinition(convertReferenceToCanonical(src.getDefinition())); - if (src.hasTransform()) - tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); - for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent(); - copyElement(src, tgt); - if (src.hasPrefix()) - tgt.setLabel(src.getPrefix()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasTextEquivalent()) - tgt.setTextEquivalent(src.getTextEquivalent()); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) - tgt.addDocumentation(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) - tgt.addGoalId(t.getValue()); - for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) - tgt.addTriggerDefinition(convertTriggerDefinition(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) - tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); - for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) - tgt.addInput(convertDataRequirement(t)); - for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) - tgt.addOutput(convertDataRequirement(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) - tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); - if (src.hasTiming()) - tgt.setTiming(convertType(src.getTiming())); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); - if (src.hasType()) - tgt.setType(convertCoding(src.getType().getCodingFirstRep())); - if (src.hasGroupingBehavior()) - tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); - if (src.hasSelectionBehavior()) - tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); - if (src.hasRequiredBehavior()) - tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); - if (src.hasPrecheckBehavior()) - tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); - if (src.hasCardinalityBehavior()) - tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); - if (src.hasDefinitionCanonicalType()) - tgt.setDefinition(convertCanonicalToReference(src.getDefinitionCanonicalType())); - if (src.hasTransform()) - tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) - tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); - for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) - tgt.addAction(convertPlanDefinitionActionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VISUALGROUP: return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.VISUALGROUP; - case LOGICALGROUP: return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.LOGICALGROUP; - case SENTENCEGROUP: return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.SENTENCEGROUP; - default: return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case VISUALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; - case LOGICALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; - case SENTENCEGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ANY: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ANY; - case ALL: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALL; - case ALLORNONE: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALLORNONE; - case EXACTLYONE: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.EXACTLYONE; - case ATMOSTONE: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ATMOSTONE; - case ONEORMORE: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ONEORMORE; - default: return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ANY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY; - case ALL: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL; - case ALLORNONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; - case EXACTLYONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; - case ATMOSTONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; - case ONEORMORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MUST: return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUST; - case COULD: return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.COULD; - case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; - default: return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MUST: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST; - case COULD: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD; - case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case YES: return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.YES; - case NO: return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NO; - default: return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case YES: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES; - case NO: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL; - } -} - - private static org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SINGLE: return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.SINGLE; - case MULTIPLE: return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.MULTIPLE; - default: return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SINGLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL; - } -} - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent(); - copyElement(src, tgt); - if (src.hasKind()) - tgt.setKind(convertActionConditionKind(src.getKind())); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent(); - copyElement(src, tgt); - if (src.hasKind()) - tgt.setKind(convertActionConditionKind(src.getKind())); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ActionConditionKind convertActionConditionKind(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPLICABILITY: return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.APPLICABILITY; - case START: return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.START; - case STOP: return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.STOP; - default: return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case APPLICABILITY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY; - case START: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START; - case STOP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL; - } -} - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); - copyElement(src, tgt); - if (src.hasActionId()) - tgt.setActionId(src.getActionId()); - if (src.hasRelationship()) - tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); - if (src.hasOffset()) - tgt.setOffset(convertType(src.getOffset())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); - copyElement(src, tgt); - if (src.hasActionId()) - tgt.setActionId(src.getActionId()); - if (src.hasRelationship()) - tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); - if (src.hasOffset()) - tgt.setOffset(convertType(src.getOffset())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BEFORESTART: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORESTART; - case BEFORE: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORE; - case BEFOREEND: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFOREEND; - case CONCURRENTWITHSTART: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHSTART; - case CONCURRENT: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENT; - case CONCURRENTWITHEND: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHEND; - case AFTERSTART: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTERSTART; - case AFTER: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTER; - case AFTEREND: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTEREND; - default: return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BEFORESTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART; - case BEFORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE; - case BEFOREEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND; - case CONCURRENTWITHSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; - case CONCURRENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT; - case CONCURRENTWITHEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; - case AFTERSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART; - case AFTER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER; - case AFTEREND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL; - } -} - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActionParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(convertActionParticipantType(src.getType())); - if (src.hasRole()) - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - private static org.hl7.fhir.r5.model.Enumerations.ActionParticipantType convertActionParticipantType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL; - } -} - - private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; - default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL; - } -} - - public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); - copyElement(src, tgt); - if (src.hasDescription()) - tgt.getExpression().setDescription(src.getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasLanguage()) - tgt.getExpression().setLanguage(src.getLanguage()); - if (src.hasExpression()) - tgt.getExpression().setExpression(src.getExpression()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); - copyElement(src, tgt); - if (src.getExpression().hasDescription()) - tgt.setDescription(src.getExpression().getDescription()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage()); - if (src.getExpression().hasExpression()) - tgt.setExpression(src.getExpression().getExpression()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - if (t.getType() == ContributorType.EDITOR) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c)); - if (t.getType() == ContributorType.REVIEWER) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c)); - if (t.getType() == ContributorType.ENDORSER) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c)); - } - - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) - tgt.addParameter(convertParameterDefinition(t)); - for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) - tgt.addDataRequirement(convertDataRequirement(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) - tgt.addContent(convertAttachment(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Library convertLibrary(org.hl7.fhir.r5.model.Library src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Library tgt = new org.hl7.fhir.dstu3.model.Library(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) - tgt.addTopic(convertCodeableConcept(t)); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.AUTHOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.EDITOR); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.REVIEWER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { - org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); - c.setType(ContributorType.ENDORSER); - c.addContact(convertContactDetail(t)); - tgt.addContributor(c); - } - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.ParameterDefinition t : src.getParameter()) - tgt.addParameter(convertParameterDefinition(t)); - for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) - tgt.addDataRequirement(convertDataRequirement(t)); - for (org.hl7.fhir.r5.model.Attachment t : src.getContent()) - tgt.addContent(convertAttachment(t)); - return tgt; - } - - - public static org.hl7.fhir.r5.model.Measure convertMeasure(org.hl7.fhir.dstu3.model.Measure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.r5.model.Measure tgt = new org.hl7.fhir.r5.model.Measure(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - for (org.hl7.fhir.dstu3.model.CodeableConcept concept : src.getType()) - tgt.addType(convertCodeableConcept(concept)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { - if (t.getType() == ContributorType.AUTHOR) - if (t.hasContact()) - for (ContactDetail c : t.getContact()) - tgt.addAuthor(convertContactDetail(c)); - else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); - if (t.getType() == ContributorType.EDITOR) - if (t.hasContact()) - for (ContactDetail c : t.getContact()) - tgt.addEditor(convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); - else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); - if (t.getType() == ContributorType.REVIEWER) - if (t.hasContact()) - for (ContactDetail c : t.getContact()) - tgt.addReviewer(convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); - else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); - if (t.getType() == ContributorType.ENDORSER) - if (t.hasContact()) - for (ContactDetail c : t.getContact()) - tgt.addEndorser(convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); - else tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); - } - // NEW - for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.dstu3.model.Reference r : src.getLibrary()) - tgt.addLibrary(r.getReference()); - if (src.hasDisclaimer()) - tgt.setDisclaimer(src.getDisclaimer()); - if (src.hasScoring()) - tgt.setScoring(convertCodeableConcept(src.getScoring())); - if (src.hasCompositeScoring()) - tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); - if (src.hasRiskAdjustment()) - tgt.setRiskAdjustment(src.getRiskAdjustment()); - if (src.hasRateAggregation()) - tgt.setRateAggregation(src.getRateAggregation()); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - if (src.hasClinicalRecommendationStatement()) - tgt.setClinicalRecommendationStatement(src.getClinicalRecommendationStatement()); - if (src.hasImprovementNotation()) { - if (src.getImprovementNotation().toLowerCase().contains("increase") || src.getImprovementNotation().toLowerCase().contains("higher")) - tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("increase").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation())); - else if (src.getImprovementNotation().toLowerCase().contains("decrease") || src.getImprovementNotation().toLowerCase().contains("lower")) - tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("decrease").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation())); - else - tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().setText(src.getImprovementNotation())); - } - for (org.hl7.fhir.dstu3.model.MarkdownType m : src.getDefinition()) - tgt.addDefinition(m.getValue()); - if (src.hasGuidance()) - tgt.setGuidance(src.getGuidance()); - for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent g : src.getGroup()) - tgt.addGroup(convertMeasureGroup(g)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Measure.MeasureGroupComponent convertMeasureGroup(org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent src) { - if (src == null) - return null; - org.hl7.fhir.r5.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupComponent(); - if (src.hasIdentifier()) - tgt.setCode(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode(src.getIdentifier().getValue()))); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent p : src.getPopulation()) - tgt.addPopulation(convertMeasureGroupPopulation(p)); - for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent s : src.getStratifier()) - tgt.addStratifier(convertMeasureGroupStratifier(s)); - return tgt; - } - - public static org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulation(org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent src) { - if (src == null) - return null; - org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent(); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasCriteria()) - tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setExpression(src.getCriteria())); - if (src.hasName()) { - if (tgt.hasCriteria()) - tgt.getCriteria().setName(src.getName()); - else - tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setName(src.getName())); - } - return tgt; - } - - public static org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifier(org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent src) { - if (src == null) - return null; - org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent(); - if (src.hasIdentifier()) - tgt.setCode(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode(src.getIdentifier().getValue()))); - if (src.hasCriteria()) - tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setExpression(src.getCriteria())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Measure convertMeasure(org.hl7.fhir.r5.model.Measure src) throws FHIRException { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Measure tgt = new org.hl7.fhir.dstu3.model.Measure(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasStatus()) - tgt.setStatus(convertPublicationStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasType()) - for (org.hl7.fhir.r5.model.CodeableConcept concept : src.getType()) - tgt.addType(convertCodeableConcept(concept)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) - tgt.addContact(convertContactDetail(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) - tgt.addUseContext(convertUsageContext(t)); - for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) - tgt.addJurisdiction(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setPurpose(src.getPurpose()); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasApprovalDate()) - tgt.setApprovalDate(src.getApprovalDate()); - if (src.hasLastReviewDate()) - tgt.setLastReviewDate(src.getLastReviewDate()); - if (src.hasEffectivePeriod()) - tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); - if (src.hasAuthor()) - for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { - ContactDetail cd = convertContactDetail(c); - Contributor con = new Contributor().setType(ContributorType.AUTHOR); - if (cd.hasName()) - con.setName(cd.getName()); - tgt.addContributor(con); - } - if (src.hasEditor()) - for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { - ContactDetail cd = convertContactDetail(c); - Contributor con = new Contributor().setType(ContributorType.EDITOR); - if (cd.hasName()) - con.setName(cd.getName()); - tgt.addContributor(con); - } - if (src.hasReviewer()) - for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { - ContactDetail cd = convertContactDetail(c); - Contributor con = new Contributor().setType(ContributorType.REVIEWER); - if (cd.hasName()) - con.setName(cd.getName()); - tgt.addContributor(con); - } - if (src.hasEndorser()) - for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { - ContactDetail cd = convertContactDetail(c); - Contributor con = new Contributor().setType(ContributorType.ENDORSER); - if (cd.hasName()) - con.setName(cd.getName()); - tgt.addContributor(con); - } - // NEW - for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) - tgt.addRelatedArtifact(convertRelatedArtifact(t)); - for (org.hl7.fhir.r5.model.CanonicalType r : src.getLibrary()) - tgt.addLibrary(convertCanonicalToReference(r)); - if (src.hasDisclaimer()) - tgt.setDisclaimer(src.getDisclaimer()); - if (src.hasScoring()) - tgt.setScoring(convertCodeableConcept(src.getScoring())); - if (src.hasCompositeScoring()) - tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); - if (src.hasRiskAdjustment()) - tgt.setRiskAdjustment(src.getRiskAdjustment()); - if (src.hasRateAggregation()) - tgt.setRateAggregation(src.getRateAggregation()); - if (src.hasRationale()) - tgt.setRationale(src.getRationale()); - if (src.hasClinicalRecommendationStatement()) - tgt.setClinicalRecommendationStatement(src.getClinicalRecommendationStatement()); - if (src.hasImprovementNotation()) - for (org.hl7.fhir.r5.model.Coding cc : src.getImprovementNotation().getCoding()) { - if (cc.hasCode() && cc.getCode().equals("increase")) - tgt.setImprovementNotation(cc.getCode()); - else if (cc.hasCode() && cc.getCode().equals("decrease")) - tgt.setImprovementNotation(cc.getCode()); - } - for (org.hl7.fhir.r5.model.MarkdownType m : src.getDefinition()) - tgt.addDefinition(m.getValue()); - if (src.hasGuidance()) - tgt.setGuidance(src.getGuidance()); - for (org.hl7.fhir.r5.model.Measure.MeasureGroupComponent g : src.getGroup()) - tgt.addGroup(convertMeasureGroup(g)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent convertMeasureGroup(org.hl7.fhir.r5.model.Measure.MeasureGroupComponent src) { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent(); - if (src.hasCode() && src.getCode().hasCoding()) - tgt.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setValue(src.getCode().getCodingFirstRep().getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent p : src.getPopulation()) - tgt.addPopulation(convertMeasureGroupPopulation(p)); - for (org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent s : src.getStratifier()) - tgt.addStratifier(convertMeasureGroupStratifier(s)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulation(org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent src) { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent(); - if (src.hasCode()) - tgt.setCode(convertCodeableConcept(src.getCode())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasCriteria() && src.getCriteria().hasExpression()) - tgt.setCriteria(src.getCriteria().getExpression()); - if (src.hasCriteria() && src.getCriteria().hasName()) { - tgt.setName(src.getCriteria().getName()); - } - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifier(org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent src) { - if (src == null) - return null; - org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent(); - if (src.hasCode() && src.getCode().hasCoding()) - tgt.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setValue(src.getCode().getCodingFirstRep().getCode())); - if (src.hasCriteria() && src.getCriteria().hasExpression()) - tgt.setCriteria(src.getCriteria().getExpression()); - return tgt; - } - - public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.ActivityDefinition) - return convertActivityDefinition((org.hl7.fhir.dstu3.model.ActivityDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.AllergyIntolerance) - return convertAllergyIntolerance((org.hl7.fhir.dstu3.model.AllergyIntolerance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu3.model.Basic) - return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu3.model.Binary) - return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu3.model.BodySite) - return convertBodySite((org.hl7.fhir.dstu3.model.BodySite) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertCapabilityStatement((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); - if (src instanceof org.hl7.fhir.dstu3.model.CareTeam) - return convertCareTeam((org.hl7.fhir.dstu3.model.CareTeam) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Claim) -// return convertClaim((org.hl7.fhir.dstu3.model.Claim) src); - if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.Communication) - return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Composition) - return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.Condition) - return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Consent) - return convertConsent((org.hl7.fhir.dstu3.model.Consent) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Contract) -// return convertContract((org.hl7.fhir.dstu3.model.Contract) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Coverage) -// return convertCoverage((org.hl7.fhir.dstu3.model.Coverage) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Device) -// return convertDevice((org.hl7.fhir.dstu3.model.Device) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) -// return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu3.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Endpoint) - return convertEndpoint((org.hl7.fhir.dstu3.model.Endpoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu3.model.ExpansionProfile) - return convertExpansionProfile((org.hl7.fhir.dstu3.model.ExpansionProfile) src); - if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu3.model.Flag) - return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu3.model.Goal) - return convertGoal((org.hl7.fhir.dstu3.model.Goal) src); - if (src instanceof org.hl7.fhir.dstu3.model.GraphDefinition) - return convertGraphDefinition((org.hl7.fhir.dstu3.model.GraphDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Group) - return convertGroup((org.hl7.fhir.dstu3.model.Group) src); - if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy)src); - if (src instanceof org.hl7.fhir.dstu3.model.Immunization) - return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.Library) - return convertLibrary((org.hl7.fhir.dstu3.model.Library) src); - if (src instanceof org.hl7.fhir.dstu3.model.Linkage) - return convertLinkage((org.hl7.fhir.dstu3.model.Linkage) src); - if (src instanceof org.hl7.fhir.dstu3.model.ListResource) - return convertList((org.hl7.fhir.dstu3.model.ListResource) src); - if (src instanceof org.hl7.fhir.dstu3.model.Location) - return convertLocation((org.hl7.fhir.dstu3.model.Location) src); - if (src instanceof org.hl7.fhir.dstu3.model.Measure) - return convertMeasure((org.hl7.fhir.dstu3.model.Measure) src); - if (src instanceof org.hl7.fhir.dstu3.model.Media) - return convertMedia((org.hl7.fhir.dstu3.model.Media) src); - if (src instanceof org.hl7.fhir.dstu3.model.Medication) - return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationAdministration) - return convertMedicationAdministration((org.hl7.fhir.dstu3.model.MedicationAdministration) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationRequest) - return convertMedicationRequest((org.hl7.fhir.dstu3.model.MedicationRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageDefinition) - return convertMessageDefinition((org.hl7.fhir.dstu3.model.MessageDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); -// if (src instanceof org.hl7.fhir.dstu3.model.NutritionOrder) -// return convertNutritionOrder((org.hl7.fhir.dstu3.model.NutritionOrder) src); - if (src instanceof org.hl7.fhir.dstu3.model.Observation) - return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Organization) - return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu3.model.Patient) - return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu3.model.PaymentNotice) - return convertPaymentNotice((org.hl7.fhir.dstu3.model.PaymentNotice) src); - if (src instanceof org.hl7.fhir.dstu3.model.Person) - return convertPerson((org.hl7.fhir.dstu3.model.Person) src); - if (src instanceof org.hl7.fhir.dstu3.model.PlanDefinition) - return convertPlanDefinition((org.hl7.fhir.dstu3.model.PlanDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); - if (src instanceof org.hl7.fhir.dstu3.model.PractitionerRole) - return convertPractitionerRole((org.hl7.fhir.dstu3.model.PractitionerRole) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu3.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Sequence) - return convertSequence((org.hl7.fhir.dstu3.model.Sequence) src); - if (src instanceof org.hl7.fhir.dstu3.model.Slot) - return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu3.model.Specimen) - return convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureMap) - return convertStructureMap((org.hl7.fhir.dstu3.model.StructureMap) src); -// if (src instanceof org.hl7.fhir.dstu3.model.Subscription) -// return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu3.model.Substance) - return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestReport) - return convertTestReport((org.hl7.fhir.dstu3.model.TestReport) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); -// if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) -// return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src); - if (!nullOk) - throw new FHIRException("Unknown resource "+src.fhirType()); - else - return null; - } - - public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, boolean nullOk) throws FHIRException { - if (src == null) - return null; - if (src instanceof org.hl7.fhir.r5.model.Parameters) { - if (((org.hl7.fhir.r5.model.Parameters) src).hasParameter("profile-url")) - return convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src); - else - return convertParameters((org.hl7.fhir.r5.model.Parameters) src); - } - if (src instanceof org.hl7.fhir.r5.model.ActivityDefinition) - return convertActivityDefinition((org.hl7.fhir.r5.model.ActivityDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.AllergyIntolerance) - return convertAllergyIntolerance((org.hl7.fhir.r5.model.AllergyIntolerance) src); - if (src instanceof org.hl7.fhir.r5.model.Appointment) - return convertAppointment((org.hl7.fhir.r5.model.Appointment) src); - if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.r5.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.r5.model.Basic) - return convertBasic((org.hl7.fhir.r5.model.Basic) src); - if (src instanceof org.hl7.fhir.r5.model.Binary) - return convertBinary((org.hl7.fhir.r5.model.Binary) src); - if (src instanceof org.hl7.fhir.r5.model.BodyStructure) - return convertBodySite((org.hl7.fhir.r5.model.BodyStructure) src); - if (src instanceof org.hl7.fhir.r5.model.Bundle) - return convertBundle((org.hl7.fhir.r5.model.Bundle) src); - if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) - return convertCapabilityStatement((org.hl7.fhir.r5.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.r5.model.CarePlan) - return convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); - if (src instanceof org.hl7.fhir.r5.model.CareTeam) - return convertCareTeam((org.hl7.fhir.r5.model.CareTeam) src); -// if (src instanceof org.hl7.fhir.r5.model.Claim) -// return convertClaim((org.hl7.fhir.r5.model.Claim) src); - if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.r5.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.r5.model.Communication) - return convertCommunication((org.hl7.fhir.r5.model.Communication) src); - if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.Composition) - return convertComposition((org.hl7.fhir.r5.model.Composition) src); - if (src instanceof org.hl7.fhir.r5.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.r5.model.Condition) - return convertCondition((org.hl7.fhir.r5.model.Condition) src); - if (src instanceof org.hl7.fhir.r5.model.Consent) - return convertConsent((org.hl7.fhir.r5.model.Consent) src); -// if (src instanceof org.hl7.fhir.r5.model.Contract) -// return convertContract((org.hl7.fhir.r5.model.Contract) src); -// if (src instanceof org.hl7.fhir.r5.model.Coverage) -// return convertCoverage((org.hl7.fhir.r5.model.Coverage) src); - if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); -// if (src instanceof org.hl7.fhir.r5.model.Device) -// return convertDevice((org.hl7.fhir.r5.model.Device) src); -// if (src instanceof org.hl7.fhir.r5.model.DeviceComponent) -// return convertDeviceComponent((org.hl7.fhir.r5.model.DeviceComponent) src); -// if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) -// return convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); -// if (src instanceof org.hl7.fhir.r5.model.DocumentManifest) -// return convertDocumentManifest((org.hl7.fhir.r5.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.r5.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.r5.model.Encounter) - return convertEncounter((org.hl7.fhir.r5.model.Encounter) src); - if (src instanceof org.hl7.fhir.r5.model.Endpoint) - return convertEndpoint((org.hl7.fhir.r5.model.Endpoint) src); - if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.r5.model.Flag) - return convertFlag((org.hl7.fhir.r5.model.Flag) src); - if (src instanceof org.hl7.fhir.r5.model.Goal) - return convertGoal((org.hl7.fhir.r5.model.Goal) src); - if (src instanceof org.hl7.fhir.r5.model.GraphDefinition) - return convertGraphDefinition((org.hl7.fhir.r5.model.GraphDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.Group) - return convertGroup((org.hl7.fhir.r5.model.Group) src); - if (src instanceof org.hl7.fhir.r5.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.r5.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.r5.model.ImagingStudy)src); - if (src instanceof org.hl7.fhir.r5.model.Immunization) - return convertImmunization((org.hl7.fhir.r5.model.Immunization) src); - if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.r5.model.Library) - return convertLibrary((org.hl7.fhir.r5.model.Library) src); - if (src instanceof org.hl7.fhir.r5.model.Linkage) - return convertLinkage((org.hl7.fhir.r5.model.Linkage) src); - if (src instanceof org.hl7.fhir.r5.model.ListResource) - return convertList((org.hl7.fhir.r5.model.ListResource) src); - if (src instanceof org.hl7.fhir.r5.model.Location) - return convertLocation((org.hl7.fhir.r5.model.Location) src); - if (src instanceof org.hl7.fhir.r5.model.Measure) - return convertMeasure((org.hl7.fhir.r5.model.Measure) src); - if (src instanceof org.hl7.fhir.r5.model.DocumentReference) - return convertMedia((org.hl7.fhir.r5.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.r5.model.Medication) - return convertMedication((org.hl7.fhir.r5.model.Medication) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationAdministration) - return convertMedicationAdministration((org.hl7.fhir.r5.model.MedicationAdministration) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationRequest) - return convertMedicationRequest((org.hl7.fhir.r5.model.MedicationRequest) src); - if (src instanceof org.hl7.fhir.r5.model.MedicationUsage) - return convertMedicationStatement((org.hl7.fhir.r5.model.MedicationUsage) src); - if (src instanceof org.hl7.fhir.r5.model.MessageDefinition) - return convertMessageDefinition((org.hl7.fhir.r5.model.MessageDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.r5.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); -// if (src instanceof org.hl7.fhir.r5.model.NutritionOrder) -// return convertNutritionOrder((org.hl7.fhir.r5.model.NutritionOrder) src); - if (src instanceof org.hl7.fhir.r5.model.Observation) - return convertObservation((org.hl7.fhir.r5.model.Observation) src); - if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.r5.model.Organization) - return convertOrganization((org.hl7.fhir.r5.model.Organization) src); - if (src instanceof org.hl7.fhir.r5.model.Patient) - return convertPatient((org.hl7.fhir.r5.model.Patient) src); - if (src instanceof org.hl7.fhir.r5.model.PaymentNotice) - return convertPaymentNotice((org.hl7.fhir.r5.model.PaymentNotice) src); - if (src instanceof org.hl7.fhir.r5.model.Person) - return convertPerson((org.hl7.fhir.r5.model.Person) src); - if (src instanceof org.hl7.fhir.r5.model.PlanDefinition) - return convertPlanDefinition((org.hl7.fhir.r5.model.PlanDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.Practitioner) - return convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); - if (src instanceof org.hl7.fhir.r5.model.PractitionerRole) - return convertPractitionerRole((org.hl7.fhir.r5.model.PractitionerRole) src); -// if (src instanceof org.hl7.fhir.r5.model.Provenance) -// return convertProvenance((org.hl7.fhir.r5.model.Provenance) src); - if (src instanceof org.hl7.fhir.r5.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.r5.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.r5.model.Schedule) - return convertSchedule((org.hl7.fhir.r5.model.Schedule) src); - if (src instanceof org.hl7.fhir.r5.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.r5.model.MolecularSequence) - return convertSequence((org.hl7.fhir.r5.model.MolecularSequence) src); - if (src instanceof org.hl7.fhir.r5.model.Slot) - return convertSlot((org.hl7.fhir.r5.model.Slot) src); - if (src instanceof org.hl7.fhir.r5.model.Specimen) - return convertSpecimen((org.hl7.fhir.r5.model.Specimen) src); - if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.r5.model.StructureMap) - return convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); -// if (src instanceof org.hl7.fhir.r5.model.Subscription) -// return convertSubscription((org.hl7.fhir.r5.model.Subscription) src); - if (src instanceof org.hl7.fhir.r5.model.Substance) - return convertSubstance((org.hl7.fhir.r5.model.Substance) src); - if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.r5.model.TestReport) - return convertTestReport((org.hl7.fhir.r5.model.TestReport) src); - if (src instanceof org.hl7.fhir.r5.model.TestScript) - return convertTestScript((org.hl7.fhir.r5.model.TestScript) src); - if (src instanceof org.hl7.fhir.r5.model.ValueSet) - return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); -// if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) -// return convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src); - if (!nullOk) - throw new FHIRException("Unknown resource "+src.fhirType()); - else - return null; - } - - public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src, boolean b) { - TerminologyCapabilities res = new TerminologyCapabilities(); - for (ParametersParameterComponent p : src.getParameter()) { - if (p.getName().equals("system")) - res.addCodeSystem().setUri(p.getValue().primitiveValue()); - } - return res; - } - - public static boolean convertsResource(String rt) { - return Utilities.existsInList(rt, "Parameters", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", - "CareTeam", "ClinicalImpression", "CodeSystem", "Communication", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "DetectedIssue", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", - "Encounter", "Endpoint", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "HealthcareService", "ImagingStudy", "Immunization", "ImplementationGuide", "Library", "Linkage", "ListResource", "Location", - "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", - "Organization", "Patient", "PaymentNotice", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "ProcessRequest", "Questionnaire", "QuestionnaireResponse", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", - "Sequence", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "TestReport", "TestScript", "ValueSet"); - } - - } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java new file mode 100644 index 000000000..1758f4266 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java @@ -0,0 +1,69 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Account10_30 { + + public static org.hl7.fhir.dstu2.model.Account convertAccount(org.hl7.fhir.dstu3.model.Account src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Account tgt = new org.hl7.fhir.dstu2.model.Account(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setName(src.getName()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setActivePeriod(VersionConvertor_10_30.convertPeriod(src.getActive())); + tgt.setBalance(VersionConvertor_10_30.convertMoney(src.getBalance())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setOwner(VersionConvertor_10_30.convertReference(src.getOwner())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.dstu2.model.Account src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setActive(VersionConvertor_10_30.convertPeriod(src.getActivePeriod())); + tgt.setBalance(VersionConvertor_10_30.convertMoney(src.getBalance())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setOwner(VersionConvertor_10_30.convertReference(src.getOwner())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu2.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE; + default: + return org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu3.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Account.AccountStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Account.AccountStatus.INACTIVE; + default: + return org.hl7.fhir.dstu2.model.Account.AccountStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java new file mode 100644 index 000000000..07b504614 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java @@ -0,0 +1,180 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Appointment10_30 { + + public static org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_30.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_30.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java new file mode 100644 index 000000000..c67ebe6d2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java @@ -0,0 +1,77 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class AppointmentResponse10_30 { + + public static org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case INPROCESS: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java new file mode 100644 index 000000000..90ead3c27 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class AuditEvent10_30 { + + public static org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.getEvent().setType(VersionConvertor_10_30.convertCoding(src.getType())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) tgt.getEvent().addSubtype(VersionConvertor_10_30.convertCoding(t)); + tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setDateTime(src.getRecorded()); + tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) tgt.getEvent().addPurposeOfEvent(VersionConvertor_10_30.convertCoding(cc)); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addParticipant(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addObject(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + if (src.hasEvent()) { + tgt.setType(VersionConvertor_10_30.convertCoding(src.getEvent().getType())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) tgt.addSubtype(VersionConvertor_10_30.convertCoding(t)); + tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setRecorded(src.getEvent().getDateTime()); + tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) tgt.addPurposeOfEvent().addCoding(VersionConvertor_10_30.convertCoding(t)); + } + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) tgt.addAgent(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setUserId(VersionConvertor_10_30.convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_30.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) tgt.addPurposeOfUse().addCoding(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setUserId(VersionConvertor_10_30.convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_30.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) tgt.addPurposeOfUse(VersionConvertor_10_30.convertCoding(cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_30.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_30.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_30.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_30.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_30.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_30.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; + case _2: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; + case _3: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; + case _5: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSite(src.getSite()); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSite(src.getSite()); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Basic10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Basic10_30.java new file mode 100644 index 000000000..4cc4cc91b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Basic10_30.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Basic10_30 { + + public static org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Binary10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Binary10_30.java new file mode 100644 index 000000000..2ffbddd3e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Binary10_30.java @@ -0,0 +1,27 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Binary10_30 { + + public static org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); + VersionConvertor_10_30.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + VersionConvertor_10_30.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java new file mode 100644 index 000000000..2b79400bb --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor30; +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle10_30 { + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + VersionConvertor_10_30.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_10_30.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); + VersionConvertor_10_30.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t, advisor)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_10_30.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + return convertBundle(src, null); + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (advisor.ignoreEntry(src)) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + org.hl7.fhir.dstu2.model.Resource res = advisor.convert(src.getResource()); + if (res == null) + res = VersionConvertor_10_30.convertResource(src.getResource()); + tgt.setResource(res); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + return convertBundleEntryComponent(src, null); + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_10_30.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java new file mode 100644 index 000000000..69cc77b11 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java @@ -0,0 +1,189 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class CarePlan10_30 { + + public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_30.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_30.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_30.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setProhibited(src.getProhibited()); + tgt.setScheduled(VersionConvertor_10_30.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_30.convertReference(t)); + tgt.setProduct(VersionConvertor_10_30.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_30.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setProhibited(src.getProhibited()); + tgt.setScheduled(VersionConvertor_10_30.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_30.convertReference(t)); + tgt.setProduct(VersionConvertor_10_30.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_30.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case DRAFT: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java new file mode 100644 index 000000000..a6bcf3c59 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.exceptions.FHIRException; + +public class ClinicalImpression10_30 { + + public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu2.model.ClinicalImpression src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setAssessor(VersionConvertor_10_30.convertReference(src.getAssessor())); + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + tgt.setPrevious(VersionConvertor_10_30.convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_10_30.convertReference(t)); + tgt.addProtocol(src.getProtocol()); + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + if (src.hasPrognosis()) + tgt.addPrognosisCodeableConcept().setText(src.getPrognosis()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ClinicalImpression tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setAssessor(VersionConvertor_10_30.convertReference(src.getAssessor())); + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + tgt.setPrevious(VersionConvertor_10_30.convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_10_30.convertReference(t)); + for (UriType t : src.getProtocol()) tgt.setProtocol(t.asStringValue()); + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setItem(VersionConvertor_10_30.convertCodeableConcept(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + try { + tgt.setItem(VersionConvertor_10_30.convertCodeableConcept(src.getItemCodeableConcept())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java new file mode 100644 index 000000000..e4056a13d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Communication10_30 { + + public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setSender(VersionConvertor_10_30.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_30.convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + case REJECTED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + case FAILED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + default: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; + case ABORTED: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; + default: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java new file mode 100644 index 000000000..c31439e0f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class CommunicationRequest10_30 { + + public static org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu3.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_30.convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequester(VersionConvertor_10_30.convertReference(src.getRequester().getAgent())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setScheduled(VersionConvertor_10_30.convertType(src.getOccurrence())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequestedOn(src.getAuthoredOn()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CommunicationRequest tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setSender(VersionConvertor_10_30.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.getRequester().setAgent(VersionConvertor_10_30.convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setOccurrence(VersionConvertor_10_30.convertType(src.getScheduled())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setAuthoredOn(src.getRequestedOn()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case PLANNED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case REQUESTED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case RECEIVED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ACCEPTED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case REJECTED: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; + default: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority priority) { + org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); + switch(priority) { + case ROUTINE: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); + break; + case URGENT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); + break; + case STAT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); + break; + case ASAP: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); + break; + default: + return null; + } + return cc; + } + + static public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { + for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ASAP; + } + return null; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java new file mode 100644 index 000000000..ed6460aba --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java @@ -0,0 +1,205 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Composition10_30 { + + public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_30.convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + try { + tgt.setConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_30.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_30.convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setConfidentiality(src.getConfidentiality().toCode()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_30.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getMode()) VersionConvertor_10_30.copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_30.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getMode()) VersionConvertor_10_30.copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_30.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_30.convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.dstu3.model.Composition.SectionMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_30.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_30.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_30.convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_30.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_30.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java new file mode 100644 index 000000000..41f94a7f9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java @@ -0,0 +1,231 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.ConceptMap; +import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap10_30 { + + public static org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_10_30.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_10_30.convertType(src.getTarget())); + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_10_30.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_10_30.convertType(src.getTarget())); + for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_10_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new VersionConvertor_10_30.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java new file mode 100644 index 000000000..38dcdc934 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java @@ -0,0 +1,141 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Condition10_30 { + + public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setAsserter(VersionConvertor_10_30.convertReference(src.getAsserter())); + if (src.hasDateRecorded()) + tgt.setAssertedDate(src.getDateRecorded()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + try { + tgt.setClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.fromCode(src.getClinicalStatus())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_30.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_30.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_30.convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setAsserter(VersionConvertor_10_30.convertReference(src.getAsserter())); + if (src.hasAssertedDate()) + tgt.setDateRecorded(src.getAssertedDate()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setClinicalStatus(src.getClinicalStatus().toCode()); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_30.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_30.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_30.convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getCode()) tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(cc)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.addCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_30.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_30.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVISIONAL: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; + case DIFFERENTIAL: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + case CONFIRMED: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; + case REFUTED: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVISIONAL: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + case DIFFERENTIAL: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + case CONFIRMED: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + case REFUTED: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java new file mode 100644 index 000000000..af73d8836 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java @@ -0,0 +1,757 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction; +import org.hl7.fhir.exceptions.FHIRException; + +public class Conformance10_30 { + + public static org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_30.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_30.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(VersionConvertor_10_30.convertReference(src.getRequest())); + tgt.setResponse(VersionConvertor_10_30.convertReference(src.getResponse())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(VersionConvertor_10_30.convertReference(src.getRequest())); + tgt.setResponse(VersionConvertor_10_30.convertReference(src.getResponse())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_10_30.convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_10_30.convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_30.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_30.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NO: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + case ELEMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + case BOTH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NO: + return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; + case EXTENSIONS: + return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; + case ELEMENTS: + return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; + case BOTH: + return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; + default: + return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Contract10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Contract10_30.java new file mode 100644 index 000000000..b2952f855 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Contract10_30.java @@ -0,0 +1,279 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.apache.commons.codec.binary.Base64; +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Contract10_30 { + + public static org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu2.model.Contract.ActorComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getEntity())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.ActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ActorComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertReference(src.getActor())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract tgt = new org.hl7.fhir.dstu2.model.Contract(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(VersionConvertor_10_30.convertPeriod(src.getApplies())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) tgt.addSubject(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) tgt.addAuthority(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) tgt.addDomain(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) tgt.addSubType(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) tgt.addActionReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contract.AgentComponent t : src.getAgent()) tgt.addActor(convertAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent t : src.getValuedItem()) tgt.addValuedItem(convertValuedItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) tgt.addTerm(convertTermComponent(t)); + tgt.setBinding(VersionConvertor_10_30.convertType(src.getBinding())); + for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) tgt.addRule(convertComputableLanguageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.dstu2.model.Contract src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(VersionConvertor_10_30.convertPeriod(src.getApplies())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSubject()) tgt.addSubject(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthority()) tgt.addAuthority(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDomain()) tgt.addDomain(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSubType()) tgt.addSubType(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) tgt.addActionReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Contract.ActorComponent t : src.getActor()) tgt.addAgent(convertAgentComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.SignatoryComponent t : src.getSigner()) tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent t : src.getValuedItem()) tgt.addValuedItem(convertValuedItemComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getTerm()) tgt.addTerm(convertTermComponent(t)); + tgt.setBinding(VersionConvertor_10_30.convertType(src.getBinding())); + for (org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent t : src.getLegal()) tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent t : src.getRule()) tgt.addRule(convertComputableLanguageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_30.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu2.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setParty(VersionConvertor_10_30.convertReference(src.getParty())); + if (src.hasSignature()) + tgt.addSignature(new org.hl7.fhir.dstu3.model.Signature().setBlob(src.getSignature().getBytes())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu2.model.Contract.SignatoryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setParty(VersionConvertor_10_30.convertReference(src.getParty())); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) tgt.setSignature(Base64.encodeBase64String(t.getBlob())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.TermActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermActorComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertReference(src.getActor())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.dstu2.model.Contract.TermActorComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getEntity())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu2.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(VersionConvertor_10_30.convertPeriod(src.getApplies())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setSubType(VersionConvertor_10_30.convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) tgt.addActionReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Contract.TermActorComponent t : src.getActor()) tgt.addAgent(convertTermAgentComponent(t)); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent t : src.getValuedItem()) tgt.addValuedItem(convertTermValuedItemComponent(t)); + for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getGroup()) tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(VersionConvertor_10_30.convertPeriod(src.getApplies())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setSubType(VersionConvertor_10_30.convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) tgt.addActionReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) tgt.addActor(convertTermAgentComponent(t)); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent t : src.getValuedItem()) tgt.addValuedItem(convertTermValuedItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertType(src.getEntity())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(VersionConvertor_10_30.convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(VersionConvertor_10_30.convertMoney(src.getNet())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertType(src.getEntity())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(VersionConvertor_10_30.convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(VersionConvertor_10_30.convertMoney(src.getNet())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertType(src.getEntity())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(VersionConvertor_10_30.convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(VersionConvertor_10_30.convertMoney(src.getNet())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertType(src.getEntity())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(VersionConvertor_10_30.convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(VersionConvertor_10_30.convertMoney(src.getNet())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java new file mode 100644 index 000000000..baa69e945 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java @@ -0,0 +1,154 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.ArrayList; +import java.util.List; + +public class DataElement10_30 { + + public static org.hl7.fhir.dstu2.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement tgt = new org.hl7.fhir.dstu2.model.DataElement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPARABLE: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; + default: + return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPARABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; + default: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java new file mode 100644 index 000000000..fc0be0ce5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DetectedIssue10_30 { + + public static org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_30.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_30.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_30.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_30.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java new file mode 100644 index 000000000..3ef4fa10f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java @@ -0,0 +1,86 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Device10_30 { + + public static org.hl7.fhir.dstu2.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Device tgt = new org.hl7.fhir.dstu2.model.Device(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + if (src.hasUdi()) + tgt.setUdi(src.getUdi().getDeviceIdentifier()); + tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setManufacturer(src.getManufacturer()); + tgt.setManufactureDate(src.getManufactureDate()); + tgt.setExpiry(src.getExpirationDate()); + tgt.setModel(src.getModel()); + tgt.setVersion(src.getVersion()); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setOwner(VersionConvertor_10_30.convertReference(src.getOwner())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_10_30.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.dstu2.model.Device src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setUdi((new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); + tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setManufacturer(src.getManufacturer()); + tgt.setManufactureDate(src.getManufactureDate()); + tgt.setExpirationDate(src.getExpiry()); + tgt.setModel(src.getModel()); + tgt.setVersion(src.getVersion()); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setOwner(VersionConvertor_10_30.convertReference(src.getOwner())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_10_30.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AVAILABLE: + return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; + case NOTAVAILABLE: + return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java new file mode 100644 index 000000000..8ac04058f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceComponent10_30 { + + public static org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setLastSystemChange(src.getLastSystemChange()); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) tgt.addOperationalStatus(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setParameterGroup(VersionConvertor_10_30.convertCodeableConcept(src.getParameterGroup())); + tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); + tgt.setLanguageCode(VersionConvertor_10_30.convertCodeableConcept(src.getLanguageCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setLastSystemChange(src.getLastSystemChange()); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus()) tgt.addOperationalStatus(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setParameterGroup(VersionConvertor_10_30.convertCodeableConcept(src.getParameterGroup())); + tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); + tgt.setLanguageCode(VersionConvertor_10_30.convertCodeableConcept(src.getLanguageCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSpecType(VersionConvertor_10_30.convertCodeableConcept(src.getSpecType())); + tgt.setComponentId(VersionConvertor_10_30.convertIdentifier(src.getComponentId())); + tgt.setProductionSpec(src.getProductionSpec()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSpecType(VersionConvertor_10_30.convertCodeableConcept(src.getSpecType())); + tgt.setComponentId(VersionConvertor_10_30.convertIdentifier(src.getComponentId())); + tgt.setProductionSpec(src.getProductionSpec()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OTHER: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: + return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OTHER: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: + return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java new file mode 100644 index 000000000..330ea73ae --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java @@ -0,0 +1,247 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceMetric10_30 { + + public static org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setUnit(VersionConvertor_10_30.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_30.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setUnit(VersionConvertor_10_30.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_30.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceUseStatement10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceUseStatement10_30.java new file mode 100644 index 000000000..2a8f12f97 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceUseStatement10_30.java @@ -0,0 +1,43 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.Annotation; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceUseStatement10_30 { + + public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setBodySite(VersionConvertor_10_30.convertType(src.getBodySite())); + tgt.setWhenUsed(VersionConvertor_10_30.convertPeriod(src.getWhenUsed())); + tgt.setDevice(VersionConvertor_10_30.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) tgt.addIndication(VersionConvertor_10_30.convertCodeableConcept(t)); + for (Annotation t : src.getNote()) tgt.addNotes(t.getText()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_30.convertType(src.getTiming())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + if (src.hasBodySiteCodeableConcept()) + tgt.setBodySite(VersionConvertor_10_30.convertCodeableConcept(src.getBodySiteCodeableConcept())); + tgt.setWhenUsed(VersionConvertor_10_30.convertPeriod(src.getWhenUsed())); + tgt.setDevice(VersionConvertor_10_30.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) tgt.addIndication(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) tgt.addNote().setText(t.getValue()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_30.convertType(src.getTiming())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java new file mode 100644 index 000000000..5888ad0eb --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java @@ -0,0 +1,121 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DiagnosticReport10_30 { + + public static org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addRequest(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addCodedDiagnosis(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_30.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest()) tgt.addBasedOn(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addCodedDiagnosis(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_30.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_30.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_30.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentManifest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentManifest10_30.java new file mode 100644 index 000000000..aac0adf87 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentManifest10_30.java @@ -0,0 +1,85 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DocumentManifest10_30 { + + public static org.hl7.fhir.dstu2.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest tgt = new org.hl7.fhir.dstu2.model.DocumentManifest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_30.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + tgt.setCreated(src.getCreated()); + tgt.setSource(src.getSource()); + tgt.setStatus(VersionConvertor_10_30.convertDocumentReferenceStatus(src.getStatus())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) tgt.addContent(convertDocumentManifestContentComponent(t)); + for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu2.model.DocumentManifest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_30.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + tgt.setCreated(src.getCreated()); + tgt.setSource(src.getSource()); + tgt.setStatus(VersionConvertor_10_30.convertDocumentReferenceStatus(src.getStatus())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) tgt.addContent(convertDocumentManifestContentComponent(t)); + for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setP(VersionConvertor_10_30.convertType(src.getP())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setP(VersionConvertor_10_30.convertType(src.getP())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_30.convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_30.convertReference(src.getRef())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java new file mode 100644 index 000000000..9e8341580 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java @@ -0,0 +1,216 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus; +import org.hl7.fhir.exceptions.FHIRException; + +public class DocumentReference10_30 { + + static public ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { + if (VersionConvertor_10_30.hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return ReferredDocumentStatus.PRELIMINARY; + if (VersionConvertor_10_30.hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return ReferredDocumentStatus.FINAL; + if (VersionConvertor_10_30.hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return ReferredDocumentStatus.AMENDED; + if (VersionConvertor_10_30.hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return ReferredDocumentStatus.ENTEREDINERROR; + return null; + } + + static public CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { + CodeableConcept cc = new CodeableConcept(); + switch(docStatus) { + case AMENDED: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); + break; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); + break; + case FINAL: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("final"); + break; + case PRELIMINARY: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); + break; + default: + return null; + } + return cc; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_30.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_30.convertCodeableConcept(src.getClass_())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + tgt.setCustodian(VersionConvertor_10_30.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_30.convertReference(src.getAuthenticator())); + tgt.setCreated(src.getCreated()); + tgt.setIndexed(src.getIndexed()); + tgt.setStatus(VersionConvertor_10_30.convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_30.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_30.convertCodeableConcept(src.getClass_())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_30.convertReference(t)); + tgt.setCustodian(VersionConvertor_10_30.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_30.convertReference(src.getAuthenticator())); + tgt.setCreated(src.getCreated()); + tgt.setIndexed(src.getIndexed()); + tgt.setStatus(VersionConvertor_10_30.convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_30.convertAttachment(src.getAttachment())); + tgt.addFormat(VersionConvertor_10_30.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_30.convertAttachment(src.getAttachment())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) tgt.setFormat(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_30.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_30.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_30.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_30.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_30.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_30.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_30.convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_30.convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java new file mode 100644 index 000000000..316f64a83 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java @@ -0,0 +1,258 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Encounter10_30 { + + public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_30.convertCodeableConcept(src.getPriority())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) tgt.addIncomingReferral(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_30.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_30.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_30.convertCodeableConcept(src.getPriority())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) tgt.addIncomingReferral(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_30.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_30.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPATIENT: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("IMP"); + case OUTPATIENT: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); + case AMBULATORY: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); + case EMERGENCY: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("EMER"); + case HOME: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("HH"); + case FIELD: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("FLD"); + case DAYTIME: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("SS"); + case VIRTUAL: + return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("VR"); + default: + return null; + } + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src.getSystem().equals("http://hl7.org/fhir/v3/ActCode")) { + if (src.getCode().equals("IMP")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; + if (src.getCode().equals("AMB")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; + if (src.getCode().equals("EMER")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; + if (src.getCode().equals("HH")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; + if (src.getCode().equals("FLD")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; + if (src.getCode().equals("")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; + if (src.getCode().equals("VR")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; + } + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_30.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_30.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_30.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_30.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_30.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_30.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_30.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_30.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_30.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_30.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_30.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_30.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; + case ARRIVED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; + case FINISHED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentRequest10_30.java new file mode 100644 index 000000000..145d9e4ed --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentRequest10_30.java @@ -0,0 +1,32 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentRequest10_30 { + + public static org.hl7.fhir.dstu3.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu3.model.EnrollmentRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setProvider(VersionConvertor_10_30.convertReference(src.getProvider())); + tgt.setOrganization(VersionConvertor_10_30.convertReference(src.getOrganization())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCoverage(VersionConvertor_10_30.convertReference(src.getCoverage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu3.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setCoverage(VersionConvertor_10_30.convertReference(src.getCoverage())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentResponse10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentResponse10_30.java new file mode 100644 index 000000000..3447411c4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EnrollmentResponse10_30.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentResponse10_30 { + + public static org.hl7.fhir.dstu3.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu3.model.EnrollmentResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setRequest(VersionConvertor_10_30.convertReference(src.getRequest())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + tgt.setOrganization(VersionConvertor_10_30.convertReference(src.getOrganization())); + tgt.setRequestProvider(VersionConvertor_10_30.convertReference(src.getRequestProvider())); + tgt.setRequestOrganization(VersionConvertor_10_30.convertReference(src.getRequestOrganization())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu3.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java new file mode 100644 index 000000000..03daba1d9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class EpisodeOfCare10_30 { + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_30.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_30.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_30.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_30.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java new file mode 100644 index 000000000..349693170 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class FamilyMemberHistory10_30 { + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_30.convertCodeableConcept(src.getRelationship())); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBorn(VersionConvertor_10_30.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_30.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_30.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_30.convertCodeableConcept(src.getRelationship())); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBorn(VersionConvertor_10_30.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_30.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_30.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_30.convertType(src.getOnset())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_30.convertType(src.getOnset())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java new file mode 100644 index 000000000..2a6b526b9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java @@ -0,0 +1,69 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Flag10_30 { + + public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java new file mode 100644 index 000000000..951106775 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Group10_30 { + + public static org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_30.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java new file mode 100644 index 000000000..3bb198a61 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java @@ -0,0 +1,157 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class HealthcareService10_30 { + + public static org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_30.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) { + if (!tgt.hasServiceType()) + tgt.addServiceType(); + tgt.getServiceType().get(0).addSpecialty(VersionConvertor_10_30.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) tgt.setLocation(VersionConvertor_10_30.convertReference(t)); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_30.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setEligibility(VersionConvertor_10_30.convertCodeableConcept(src.getEligibility())); + tgt.setEligibilityNote(src.getEligibilityNote()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) tgt.addProgramName(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_30.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { + for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) tgt.addSpecialty(VersionConvertor_10_30.convertCodeableConcept(tj)); + } + tgt.addLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_30.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setEligibility(VersionConvertor_10_30.convertCodeableConcept(src.getEligibility())); + tgt.setEligibilityNote(src.getEligibilityNote()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) tgt.addProgramName(t.getValue()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_30.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_30.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_30.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_30.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java new file mode 100644 index 000000000..ed91cf1db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java @@ -0,0 +1,145 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ImagingStudy10_30 { + + public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu2.model.ImagingStudy src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUid(src.getUid()); + tgt.setAccession(VersionConvertor_10_30.convertIdentifier(src.getAccession())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getModalityList()) tgt.addModalityList(VersionConvertor_10_30.convertCoding(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setStarted(src.getStarted()); + tgt.setReferrer(VersionConvertor_10_30.convertReference(src.getReferrer())); + tgt.addInterpreter(VersionConvertor_10_30.convertReference(src.getInterpreter())); + tgt.setNumberOfSeries(src.getNumberOfSeries()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProcedure()) tgt.addProcedureReference(VersionConvertor_10_30.convertReference(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImagingStudy tgt = new org.hl7.fhir.dstu2.model.ImagingStudy(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUid(src.getUid()); + tgt.setAccession(VersionConvertor_10_30.convertIdentifier(src.getAccession())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) tgt.addModalityList(VersionConvertor_10_30.convertCoding(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setStarted(src.getStarted()); + tgt.setReferrer(VersionConvertor_10_30.convertReference(src.getReferrer())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) tgt.setInterpreter(VersionConvertor_10_30.convertReference(t)); + tgt.setNumberOfSeries(src.getNumberOfSeries()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProcedureReference()) tgt.addProcedure(VersionConvertor_10_30.convertReference(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setModality(VersionConvertor_10_30.convertCoding(src.getModality())); + tgt.setDescription(src.getDescription()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setBodySite(VersionConvertor_10_30.convertCoding(src.getBodySite())); + tgt.setLaterality(VersionConvertor_10_30.convertCoding(src.getLaterality())); + tgt.setStarted(src.getStarted()); + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setModality(VersionConvertor_10_30.convertCoding(src.getModality())); + tgt.setDescription(src.getDescription()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setBodySite(VersionConvertor_10_30.convertCoding(src.getBodySite())); + tgt.setLaterality(VersionConvertor_10_30.convertCoding(src.getLaterality())); + tgt.setStarted(src.getStarted()); + for (org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setSopClass(src.getSopClass()); + tgt.setTitle(src.getTitle()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setSopClass(src.getSopClass()); + tgt.setTitle(src.getTitle()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ONLINE: + return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: + return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: + return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: + return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: + return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ONLINE: + return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: + return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: + return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: + return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: + return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java new file mode 100644 index 000000000..9b4f90483 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java @@ -0,0 +1,169 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class Immunization10_30 { + + public static org.hl7.fhir.dstu2.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Immunization tgt = new org.hl7.fhir.dstu2.model.Immunization(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(src.getStatus().toCode()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(VersionConvertor_10_30.convertCodeableConcept(src.getVaccineCode())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setWasNotGiven(src.getNotGiven()); + tgt.setReported(!src.getPrimarySource()); + tgt.setPerformer(VersionConvertor_10_30.convertReference(getPerformer(src.getPractitioner()))); + tgt.setRequester(VersionConvertor_10_30.convertReference(getRequester(src.getPractitioner()))); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setManufacturer(VersionConvertor_10_30.convertReference(src.getManufacturer())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setExpirationDate(src.getExpirationDate()); + tgt.setSite(VersionConvertor_10_30.convertCodeableConcept(src.getSite())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setDoseQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_10_30.convertAnnotation(t)); + tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.dstu2.model.Immunization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + try { + tgt.setStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.fromCode(src.getStatus())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(VersionConvertor_10_30.convertCodeableConcept(src.getVaccineCode())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setNotGiven(src.getWasNotGiven()); + tgt.setPrimarySource(!src.getReported()); + if (src.hasPerformer()) + tgt.addPractitioner().setActor(VersionConvertor_10_30.convertReference(src.getPerformer())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("AP"))); + if (src.hasRequester()) + tgt.addPractitioner().setActor(VersionConvertor_10_30.convertReference(src.getRequester())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("OP"))); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setManufacturer(VersionConvertor_10_30.convertReference(src.getManufacturer())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setExpirationDate(src.getExpirationDate()); + tgt.setSite(VersionConvertor_10_30.convertCodeableConcept(src.getSite())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setDoseQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_10_30.convertAnnotation(t)); + tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); + for (org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) tgt.addReasonNotGiven(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotGiven()) tgt.addReasonNotGiven(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDetail(VersionConvertor_10_30.convertReference(src.getDetail())); + tgt.setReported(src.getReported()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationReactionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDetail(VersionConvertor_10_30.convertReference(src.getDetail())); + tgt.setReported(src.getReported()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(VersionConvertor_10_30.convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTargetDisease()) tgt.addTargetDisease(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDoseStatus(VersionConvertor_10_30.convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(VersionConvertor_10_30.convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu2.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(VersionConvertor_10_30.convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getTargetDisease()) tgt.addTargetDisease(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setDoseStatus(VersionConvertor_10_30.convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(VersionConvertor_10_30.convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Reference getPerformer(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (VersionConvertor_10_30.hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + static public org.hl7.fhir.dstu3.model.Reference getRequester(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (VersionConvertor_10_30.hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImmunizationRecommendation10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImmunizationRecommendation10_30.java new file mode 100644 index 000000000..f844a82db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImmunizationRecommendation10_30.java @@ -0,0 +1,107 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ImmunizationRecommendation10_30 { + + public static org.hl7.fhir.dstu2.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu3.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu2.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(VersionConvertor_10_30.convertCodeableConcept(src.getVaccineCode())); + tgt.setDoseNumber(src.getDoseNumber()); + tgt.setForecastStatus(VersionConvertor_10_30.convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingImmunization()) tgt.addSupportingImmunization(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingPatientInformation()) tgt.addSupportingPatientInformation(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(VersionConvertor_10_30.convertCodeableConcept(src.getVaccineCode())); + tgt.setDoseNumber(src.getDoseNumber()); + tgt.setForecastStatus(VersionConvertor_10_30.convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingImmunization()) tgt.addSupportingImmunization(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingPatientInformation()) tgt.addSupportingPatientInformation(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(VersionConvertor_10_30.convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu2.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(VersionConvertor_10_30.convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java new file mode 100644 index 000000000..5b3ff7d06 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java @@ -0,0 +1,285 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ImplementationGuide10_30 { + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REFERENCE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REFERENCE: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PAGE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PAGE: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: + return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu2.model.UriType t : src.getBinary()) tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setExample(src.getPurpose() == org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setAcronym(src.getAcronym()); + tgt.setSource(VersionConvertor_10_30.convertType(src.getSource())); + tgt.setExampleFor(VersionConvertor_10_30.convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.getExample()) + tgt.setPurpose(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); + else + tgt.setPurpose(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideResourcePurpose.PROFILE); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setAcronym(src.getAcronym()); + tgt.setSource(VersionConvertor_10_30.convertType(src.getSource())); + tgt.setExampleFor(VersionConvertor_10_30.convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setName(src.getTitle()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setTitle(src.getName()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java new file mode 100644 index 000000000..c02a47f8c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class List10_30 { + + public static org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_30.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_30.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_30.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_30.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + } + } + + public static void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_30.convertExtension(e)); + } + } + + public static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_30.convertExtension(e)); + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java new file mode 100644 index 000000000..7f96bdff5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java @@ -0,0 +1,125 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Location10_30 { + + public static org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_30.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_30.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java new file mode 100644 index 000000000..b169fe043 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java @@ -0,0 +1,77 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Media10_30 { + + public static org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHOTO: + return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; + case VIDEO: + return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; + case AUDIO: + return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; + default: + return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PHOTO: + return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO; + case VIDEO: + return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO; + case AUDIO: + return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO; + default: + return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Media tgt = new org.hl7.fhir.dstu2.model.Media(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setSubtype(VersionConvertor_10_30.convertCodeableConcept(src.getSubtype())); + tgt.setView(VersionConvertor_10_30.convertCodeableConcept(src.getView())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setOperator(VersionConvertor_10_30.convertReference(src.getOperator())); + tgt.setDeviceName(src.getDevice().getDisplay()); + tgt.setHeight(src.getHeight()); + tgt.setWidth(src.getWidth()); + tgt.setFrames(src.getFrames()); + tgt.setDuration(src.getDuration()); + tgt.setContent(VersionConvertor_10_30.convertAttachment(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.dstu2.model.Media src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setSubtype(VersionConvertor_10_30.convertCodeableConcept(src.getSubtype())); + tgt.setView(VersionConvertor_10_30.convertCodeableConcept(src.getView())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setOperator(VersionConvertor_10_30.convertReference(src.getOperator())); + tgt.getDevice().setDisplay(src.getDeviceName()); + tgt.setHeight(src.getHeight()); + tgt.setWidth(src.getWidth()); + tgt.setFrames(src.getFrames()); + tgt.setDuration(src.getDuration()); + tgt.setContent(VersionConvertor_10_30.convertAttachment(src.getContent())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Medication10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Medication10_30.java new file mode 100644 index 000000000..76d954284 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Medication10_30.java @@ -0,0 +1,72 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Medication10_30 { + + public static org.hl7.fhir.dstu2.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Medication tgt = new org.hl7.fhir.dstu2.model.Medication(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setIsBrand(src.getIsBrand()); + tgt.setManufacturer(VersionConvertor_10_30.convertReference(src.getManufacturer())); + tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.dstu2.model.Medication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setIsBrand(src.getIsBrand()); + tgt.setManufacturer(VersionConvertor_10_30.convertReference(src.getManufacturer())); + tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContainer(VersionConvertor_10_30.convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent t : src.getContent()) tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setContainer(VersionConvertor_10_30.convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent t : src.getContent()) tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasItemReference()) + tgt.setItem((org.hl7.fhir.dstu2.model.Reference) VersionConvertor_10_30.convertType(src.getItem())); + tgt.setAmount(VersionConvertor_10_30.convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setItem(VersionConvertor_10_30.convertType(src.getItem())); + tgt.setAmount(VersionConvertor_10_30.convertSimpleQuantity(src.getAmount())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java new file mode 100644 index 000000000..bd53b34e9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.Dosage; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationDispense10_30 { + + public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_30.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_30.convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_30.convertReference(t)); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_30.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_30.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_30.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setDose(VersionConvertor_10_30.convertType(src.getDose())); + tgt.setRate(VersionConvertor_10_30.convertType(src.getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_30.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_30.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_30.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setDose(VersionConvertor_10_30.convertType(src.getDose())); + tgt.setRate(VersionConvertor_10_30.convertType(src.getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_30.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_10_30.convertReference(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java new file mode 100644 index 000000000..6c46dc671 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java @@ -0,0 +1,115 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationStatement10_30 { + + public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_30.convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) tgt.addDerivedFrom(VersionConvertor_10_30.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotTaken()) tgt.addReasonNotTaken(VersionConvertor_10_30.convertCodeableConcept(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_30.convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) tgt.addSupportingInformation(VersionConvertor_10_30.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) tgt.addReasonNotTaken(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_30.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_30.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setRate(VersionConvertor_10_30.convertType(src.getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_30.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_30.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_30.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_30.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setRate(VersionConvertor_10_30.convertType(src.getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_30.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java new file mode 100644 index 000000000..ef842d48f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java @@ -0,0 +1,145 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageHeader10_30 { + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(VersionConvertor_10_30.convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_30.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setReceiver(VersionConvertor_10_30.convertReference(src.getReceiver())); + tgt.setResponsible(VersionConvertor_10_30.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_30.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) tgt.addData(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(VersionConvertor_10_30.convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_30.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setReceiver(VersionConvertor_10_30.convertReference(src.getReceiver())); + tgt.setResponsible(VersionConvertor_10_30.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_30.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) tgt.addFocus(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_30.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_30.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_30.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_30.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java new file mode 100644 index 000000000..c54171bf0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java @@ -0,0 +1,164 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem10_30 { + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(VersionConvertor_10_30.convertReference(src.getReplacedBy())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(VersionConvertor_10_30.convertReference(src.getReplacedBy())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java new file mode 100644 index 000000000..f39c8f4b1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java @@ -0,0 +1,221 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Observation10_30 { + + public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_30.convertReference(t)); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_30.convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(VersionConvertor_10_30.convertCodeableConcept(src.getInterpretation())); + tgt.setComment(src.getComments()); + tgt.setBodySite(VersionConvertor_10_30.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_30.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_30.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(c)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setEffective(VersionConvertor_10_30.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_30.convertReference(t)); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_30.convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(VersionConvertor_10_30.convertCodeableConcept(src.getInterpretation())); + tgt.setComments(src.getComment()); + tgt.setBodySite(VersionConvertor_10_30.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_30.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_30.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_30.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_30.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_30.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_30.convertSimpleQuantity(src.getHigh())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getMeaning())); + tgt.setAge(VersionConvertor_10_30.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_30.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_30.convertSimpleQuantity(src.getHigh())); + tgt.setMeaning(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setAge(VersionConvertor_10_30.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HASMEMBER: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: + return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HASMEMBER: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: + return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java new file mode 100644 index 000000000..2b821f33a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java @@ -0,0 +1,207 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +public class OperationDefinition10_30 { + + public static org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_10_30.convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBase(VersionConvertor_10_30.convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_30.convertBindingStrength(src.getStrength())); + tgt.setValueSet(VersionConvertor_10_30.convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_30.convertBindingStrength(src.getStrength())); + tgt.setValueSet(VersionConvertor_10_30.convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + } else + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { + tgt.setType("string"); + tgt.setSearchType(SearchParamType.fromCode(src.getType())); + } else { + tgt.setType(src.getType()); + } + tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java new file mode 100644 index 000000000..c48e62398 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java @@ -0,0 +1,219 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome10_30 { + + public static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_30.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_30.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Organization10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Organization10_30.java new file mode 100644 index 000000000..4a15613c9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Organization10_30.java @@ -0,0 +1,63 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Organization10_30 { + + public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_30.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_30.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_30.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Parameters10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Parameters10_30.java new file mode 100644 index 000000000..783abfdd0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Parameters10_30.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters10_30 { + + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + VersionConvertor_10_30.copyResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); + VersionConvertor_10_30.copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_30.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_30.convertResource(src.getResource())); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java new file mode 100644 index 000000000..078237a94 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java @@ -0,0 +1,181 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Patient10_30 { + + public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSpecies(VersionConvertor_10_30.convertCodeableConcept(src.getSpecies())); + tgt.setBreed(VersionConvertor_10_30.convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(VersionConvertor_10_30.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSpecies(VersionConvertor_10_30.convertCodeableConcept(src.getSpecies())); + tgt.setBreed(VersionConvertor_10_30.convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(VersionConvertor_10_30.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_30.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_30.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REPLACES: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REFER: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACE: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + case REFER: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_30.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_30.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_30.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_30.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + tgt.setAnimal(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) tgt.addGeneralPractitioner(VersionConvertor_10_30.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_30.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_30.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_30.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_30.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + tgt.setAnimal(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) tgt.addCareProvider(VersionConvertor_10_30.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_30.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_30.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_30.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_30.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java new file mode 100644 index 000000000..0d0b88716 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java @@ -0,0 +1,97 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Person10_30 { + + public static org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_30.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_30.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_30.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_30.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_30.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Practitioner10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Practitioner10_30.java new file mode 100644 index 000000000..dba28bec7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Practitioner10_30.java @@ -0,0 +1,68 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Practitioner10_30 { + + public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + if (src.hasName()) + tgt.addName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.setName(VersionConvertor_10_30.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_30.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_30.convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_30.convertReference(src.getIssuer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java new file mode 100644 index 000000000..ad72c1cea --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java @@ -0,0 +1,137 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Procedure10_30 { + + public static org.hl7.fhir.dstu2.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Procedure tgt = new org.hl7.fhir.dstu2.model.Procedure(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setNotPerformed(src.getNotDone()); + tgt.addReasonNotPerformed(VersionConvertor_10_30.convertCodeableConcept(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setReason(VersionConvertor_10_30.convertType(src.getReasonCodeFirstRep())); + for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertProcedurePerformerComponent(t)); + tgt.setPerformed(VersionConvertor_10_30.convertType(src.getPerformed())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) tgt.addReport(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) tgt.addComplication(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) tgt.addFollowUp(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequest(VersionConvertor_10_30.convertReference(src.getBasedOnFirstRep())); + for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.dstu2.model.Procedure src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setNotDone(src.getNotPerformed()); + if (src.hasReasonNotPerformed()) + tgt.setNotDoneReason(VersionConvertor_10_30.convertCodeableConcept(src.getReasonNotPerformed().get(0))); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + if (src.hasReasonCodeableConcept()) + tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(src.getReasonCodeableConcept())); + for (org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertProcedurePerformerComponent(t)); + tgt.setPerformed(VersionConvertor_10_30.convertType(src.getPerformed())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReport()) tgt.addReport(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getComplication()) tgt.addComplication(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getFollowUp()) tgt.addFollowUp(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.addBasedOn(VersionConvertor_10_30.convertReference(src.getRequest())); + for (org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_30.convertCodeableConcept(src.getAction())); + tgt.setManipulated(VersionConvertor_10_30.convertReference(src.getManipulated())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu2.model.Procedure.ProcedureFocalDeviceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_30.convertCodeableConcept(src.getAction())); + tgt.setManipulated(VersionConvertor_10_30.convertReference(src.getManipulated())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setRole(VersionConvertor_10_30.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu2.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setRole(VersionConvertor_10_30.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: + return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java new file mode 100644 index 000000000..b47e82dfe --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java @@ -0,0 +1,128 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ProcedureRequest10_30 { + + public static org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu2.model.ProcedureRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + if (src.hasReasonCodeableConcept()) + tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(src.getReasonCodeableConcept())); + tgt.setOccurrence(VersionConvertor_10_30.convertType(src.getScheduled())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + tgt.setAuthoredOn(src.getOrderedOn()); + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ProcedureRequest tgt = new org.hl7.fhir.dstu2.model.ProcedureRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setReason(VersionConvertor_10_30.convertType(src.getReasonCodeFirstRep())); + tgt.setScheduled(VersionConvertor_10_30.convertType(src.getOccurrence())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); + tgt.setOrderedOn(src.getAuthoredOn()); + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.ABORTED; + default: + return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case DRAFT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case REQUESTED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case RECEIVED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case ACCEPTED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; + case ABORTED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java new file mode 100644 index 000000000..15d8793ec --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java @@ -0,0 +1,120 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Provenance10_30 { + + public static org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) tgt.addTarget(VersionConvertor_10_30.convertReference(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) tgt.addReason().addCoding(VersionConvertor_10_30.convertCoding(t)); + tgt.setActivity(new org.hl7.fhir.dstu2.model.CodeableConcept().addCoding(VersionConvertor_10_30.convertCoding(src.getActivity()))); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) tgt.addSignature(VersionConvertor_10_30.convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.dstu2.model.Provenance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Reference t : src.getTarget()) tgt.addTarget(VersionConvertor_10_30.convertReference(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) for (org.hl7.fhir.dstu2.model.Coding tc : t.getCoding()) tgt.addReason(VersionConvertor_10_30.convertCoding(tc)); + for (org.hl7.fhir.dstu2.model.Coding t : src.getActivity().getCoding()) tgt.setActivity(VersionConvertor_10_30.convertCoding(t)); + tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu2.model.Signature t : src.getSignature()) tgt.addSignature(VersionConvertor_10_30.convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasWhoReference()) + tgt.setActor(VersionConvertor_10_30.convertReference(src.getWhoReference())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setWho(VersionConvertor_10_30.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhatReference() && src.getWhatReference().hasReference()) + tgt.setReference(src.getWhatReference().getReference()); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.setAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasReference()) + tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); + tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + default: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; + default: + return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java new file mode 100644 index 000000000..c66483666 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java @@ -0,0 +1,240 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.exceptions.FHIRException; + +public class Questionnaire10_30 { + + public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t1)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); + root.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) { + root.addConcept(VersionConvertor_10_30.convertCoding(t)); + } + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) + root.addGroup(convertQuestionnaireGroupComponent(t)); + else + root.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); + tgt.setTitle(root.getTitle()); + for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) tgt.addCode(VersionConvertor_10_30.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + tgt.addItem(convertQuestionnaireGroupComponent(root)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_30.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + else + tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_30.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; + case STRING: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; + case TEXT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; + case URL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; + case CHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_30.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(VersionConvertor_10_30.convertReference(src.getOptions())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) tgt.addOption().setValue(VersionConvertor_10_30.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_30.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(VersionConvertor_10_30.convertReference(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) if (t.hasValueCoding()) + try { + tgt.addOption(VersionConvertor_10_30.convertCoding(t.getValueCoding())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java new file mode 100644 index 000000000..f52907f01 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java @@ -0,0 +1,144 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse10_30 { + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_10_30.convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + if (src.getItem().size() != 1) + throw new FHIRException("multiple root items not supported"); + tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_10_30.convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_30.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_30.convertReference(src.getSource())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + if (src.hasGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java new file mode 100644 index 000000000..0dba57c46 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java @@ -0,0 +1,128 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority; +import org.hl7.fhir.exceptions.FHIRException; + +public class ReferralRequest10_30 { + + static public org.hl7.fhir.dstu2.model.CodeableConcept convertReferralPriorityCode(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority priority) { + org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); + switch(priority) { + case ROUTINE: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); + break; + case URGENT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); + break; + case STAT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); + break; + case ASAP: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); + break; + default: + return null; + } + return cc; + } + + static public ReferralPriority convertReferralPriorityCode(CodeableConcept priority) { + for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ASAP; + } + return null; + } + + public static org.hl7.fhir.dstu2.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ReferralRequest tgt = new org.hl7.fhir.dstu2.model.ReferralRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setPriority(convertReferralPriorityCode(src.getPriority())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setFulfillmentTime(VersionConvertor_10_30.convertPeriod(src.getOccurrencePeriod())); + tgt.setRequester(VersionConvertor_10_30.convertReference(src.getRequester().getAgent())); + tgt.setSpecialty(VersionConvertor_10_30.convertCodeableConcept(src.getSpecialty())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getReasonCode()) tgt.setReason(VersionConvertor_10_30.convertCodeableConcept(cc)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceRequested()) tgt.addServiceRequested(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) tgt.addSupportingInformation(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu2.model.ReferralRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ReferralRequest tgt = new org.hl7.fhir.dstu3.model.ReferralRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setPriority(convertReferralPriorityCode(src.getPriority())); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setOccurrence(VersionConvertor_10_30.convertPeriod(src.getFulfillmentTime())); + tgt.getRequester().setAgent(VersionConvertor_10_30.convertReference(src.getRequester())); + tgt.setSpecialty(VersionConvertor_10_30.convertCodeableConcept(src.getSpecialty())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_30.convertReference(t)); + tgt.addReasonCode(VersionConvertor_10_30.convertCodeableConcept(src.getReason())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceRequested()) tgt.addServiceRequested(VersionConvertor_10_30.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInfo(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus convertReferralStatus(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.REJECTED; + default: + return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus convertReferralStatus(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + case REQUESTED: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED; + case ACCEPTED: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + case REJECTED: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED; + default: + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RelatedPerson10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RelatedPerson10_30.java new file mode 100644 index 000000000..fa22bb003 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RelatedPerson10_30.java @@ -0,0 +1,44 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class RelatedPerson10_30 { + + public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu2.model.RelatedPerson src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setRelationship(VersionConvertor_10_30.convertCodeableConcept(src.getRelationship())); + tgt.addName(VersionConvertor_10_30.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RelatedPerson tgt = new org.hl7.fhir.dstu2.model.RelatedPerson(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setRelationship(VersionConvertor_10_30.convertCodeableConcept(src.getRelationship())); + if (!src.getName().isEmpty()) + tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName().get(0))); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_30.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_30.convertAddress(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_30.convertAttachment(t)); + tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RiskAssessment10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RiskAssessment10_30.java new file mode 100644 index 000000000..9937ea2e4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/RiskAssessment10_30.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class RiskAssessment10_30 { + + public static org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_30.convertReference(src.getCondition())); + tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); + tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_30.convertReference(src.getCondition())); + tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_30.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_30.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_30.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_30.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_30.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Schedule10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Schedule10_30.java new file mode 100644 index 000000000..284ba98c1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Schedule10_30.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Schedule10_30 { + + public static org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_30.convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(VersionConvertor_10_30.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addServiceType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.addActor(VersionConvertor_10_30.convertReference(src.getActor())); + tgt.setPlanningHorizon(VersionConvertor_10_30.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java new file mode 100644 index 000000000..4ab2b1967 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java @@ -0,0 +1,118 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu2.utils.ToolingExtensions; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter10_30 { + + public static org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_10_30.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_10_30.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Slot10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Slot10_30.java new file mode 100644 index 000000000..d2149fe8d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Slot10_30.java @@ -0,0 +1,38 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Slot10_30 { + + public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setSchedule(VersionConvertor_10_30.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setSchedule(VersionConvertor_10_30.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Specimen10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Specimen10_30.java new file mode 100644 index 000000000..f84b03d2c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Specimen10_30.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.Specimen; +import org.hl7.fhir.exceptions.FHIRException; + +public class Specimen10_30 { + + static public org.hl7.fhir.dstu2.model.Specimen convertSpecimen(Specimen src) { + if (src == null) { + return null; + } + org.hl7.fhir.dstu2.model.Specimen tgt = new org.hl7.fhir.dstu2.model.Specimen(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(VersionConvertor_10_30.convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTime(src.getReceivedTime()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.addParent(VersionConvertor_10_30.convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) tgt.addTreatment(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) tgt.addContainer(convertSpecimenContainerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenCollectionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(VersionConvertor_10_30.convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(VersionConvertor_10_30.convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_10_30.convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_10_30.convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenContainerComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(VersionConvertor_10_30.convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(VersionConvertor_10_30.convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent tgt = new org.hl7.fhir.dstu2.model.Specimen.SpecimenTreatmentComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(VersionConvertor_10_30.convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) tgt.addAdditive(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus convertSpecimenStatus(Specimen.SpecimenStatus status) { + if (status == null) { + return null; + } + switch(status) { + case AVAILABLE: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.UNAVAILABLE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.ENTEREDINERROR; + case UNSATISFACTORY: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case NULL: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.NULL; + default: + return org.hl7.fhir.dstu2.model.Specimen.SpecimenStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java new file mode 100644 index 000000000..ef08d1852 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java @@ -0,0 +1,270 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +import java.util.ArrayList; +import java.util.List; + +public class StructureDefinition10_30 { + + public static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_10_30.convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_10_30.convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + tgt.getType()); + tgt.setType(tgt.getId()); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + static public String tail(String base) { + return base.substring(base.lastIndexOf("/") + 1); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java new file mode 100644 index 000000000..a2d361030 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java @@ -0,0 +1,136 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Subscription10_30 { + + public static org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) tgt.addTag(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_30.convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) tgt.addTag(VersionConvertor_10_30.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + if (src.hasHeader()) + tgt.setHeaderElement(VersionConvertor_10_30.convertString(src.getHeader().get(0))); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + tgt.addHeader(src.getHeader()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Substance10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Substance10_30.java new file mode 100644 index 000000000..413160599 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Substance10_30.java @@ -0,0 +1,76 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Substance10_30 { + + public static org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_30.convertRatio(src.getQuantity())); + tgt.setSubstance(VersionConvertor_10_30.convertReference(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_30.convertRatio(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_30.convertSimpleQuantity(src.getQuantity())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java new file mode 100644 index 000000000..2255075df --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyDelivery10_30 { + + public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_30.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_30.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_30.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_30.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyRequest10_30.java new file mode 100644 index 000000000..01c88f3e1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyRequest10_30.java @@ -0,0 +1,22 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyRequest10_30 { + + public static org.hl7.fhir.dstu3.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SupplyRequest tgt = new org.hl7.fhir.dstu3.model.SupplyRequest(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java new file mode 100644 index 000000000..adffd85aa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java @@ -0,0 +1,614 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestScript10_30 { + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; + case JSON: + return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; + default: + return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + case JSON: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + default: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_30.convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_30.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_30.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setConformance(VersionConvertor_10_30.convertReference(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setCapabilities(VersionConvertor_10_30.convertReference(src.getConformance())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java new file mode 100644 index 000000000..8025de030 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java @@ -0,0 +1,409 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor30; +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class ValueSet10_30 { + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem(); + VersionConvertor_10_30.copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName() + " Code System"); + tgtcs.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_30.isJurisdiction(t)) + tgtcs.addJurisdiction(VersionConvertor_10_30.convertCodeableConcept(t)); + else + tgtcs.addUseContext(VersionConvertor_10_30.convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src, VersionConvertorAdvisor30 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); + VersionConvertor_10_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier i : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_30.convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + org.hl7.fhir.dstu3.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_30.convertType(src.getValue())); + return tgt; + } + + static public void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_30.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs); + } + + static public void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_30.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Appointment10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Appointment10_40.java new file mode 100644 index 000000000..e94249ad5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Appointment10_40.java @@ -0,0 +1,180 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Appointment10_40 { + + public static org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_40.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_40.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_40.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_40.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r4.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AppointmentResponse10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AppointmentResponse10_40.java new file mode 100644 index 000000000..d1dee035e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AppointmentResponse10_40.java @@ -0,0 +1,77 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class AppointmentResponse10_40 { + + public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_40.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_40.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_40.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_40.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case INPROCESS: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case COMPLETED: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case NEEDSACTION: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AuditEvent10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AuditEvent10_40.java new file mode 100644 index 000000000..78a80899f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/AuditEvent10_40.java @@ -0,0 +1,308 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class AuditEvent10_40 { + + public static org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + if (src.hasEvent()) { + tgt.setType(VersionConvertor_10_40.convertCoding(src.getEvent().getType())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) tgt.addSubtype(VersionConvertor_10_40.convertCoding(t)); + tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setRecorded(src.getEvent().getDateTime()); + tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) tgt.addPurposeOfEvent().addCoding(VersionConvertor_10_40.convertCoding(t)); + } + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) tgt.addAgent(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.getEvent().setType(VersionConvertor_10_40.convertCoding(src.getType())); + for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) tgt.getEvent().addSubtype(VersionConvertor_10_40.convertCoding(t)); + tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setDateTime(src.getRecorded()); + tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) for (org.hl7.fhir.r4.model.Coding cc : t.getCoding()) tgt.getEvent().addPurposeOfEvent(VersionConvertor_10_40.convertCoding(cc)); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addParticipant(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addObject(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setWho(VersionConvertor_10_40.convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_40.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) tgt.addPurposeOfUse().addCoding(VersionConvertor_10_40.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_40.convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(VersionConvertor_10_40.convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(VersionConvertor_10_40.convertReference(src.getWho())); + } + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_40.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) for (org.hl7.fhir.r4.model.Coding cc : t.getCoding()) tgt.addPurposeOfUse(VersionConvertor_10_40.convertCoding(cc)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(VersionConvertor_10_40.convertReference(src.getReference())); + tgt.setType(VersionConvertor_10_40.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_40.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_40.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_40.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(VersionConvertor_10_40.convertReference(src.getWhat())); + } + tgt.setType(VersionConvertor_10_40.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_40.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_40.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_40.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; + case _2: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; + case _3: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; + case _5: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + } + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCoding(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Basic10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Basic10_40.java new file mode 100644 index 000000000..bea50dcdd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Basic10_40.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Basic10_40 { + + public static org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Binary10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Binary10_40.java new file mode 100644 index 000000000..4aac9327f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Binary10_40.java @@ -0,0 +1,27 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Binary10_40 { + + public static org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); + VersionConvertor_10_40.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); + VersionConvertor_10_40.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java new file mode 100644 index 000000000..865d641ff --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle10_40 { + + public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); + VersionConvertor_10_40.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_10_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); + VersionConvertor_10_40.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t, advisor)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_10_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { + return convertBundle(src, null); + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_10_40.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (advisor.ignoreEntry(src)) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource()); + if (res == null) + res = VersionConvertor_10_40.convertResource(src.getResource()); + tgt.setResource(res); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { + return convertBundleEntryComponent(src, null); + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CarePlan10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CarePlan10_40.java new file mode 100644 index 000000000..34f5aefb1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CarePlan10_40.java @@ -0,0 +1,192 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CarePlan10_40 { + + public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getContext())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) if (!tgt.hasAuthor()) + tgt.setAuthor(VersionConvertor_10_40.convertReference(t)); + else + tgt.addContributor(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + if (src.hasAuthor()) + tgt.addAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Reference t : src.getContributor()) tgt.addAuthor(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_40.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_40.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_40.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_40.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_40.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setProhibited(src.getDoNotPerform()); + tgt.setScheduled(VersionConvertor_10_40.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_40.convertReference(t)); + tgt.setProduct(VersionConvertor_10_40.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_40.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_40.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setDoNotPerform(src.getProhibited()); + tgt.setScheduled(VersionConvertor_10_40.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_40.convertReference(t)); + tgt.setProduct(VersionConvertor_10_40.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_40.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case DRAFT: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED; + default: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; + case REVOKED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Communication10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Communication10_40.java new file mode 100644 index 000000000..23958db94 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Communication10_40.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Communication10_40 { + + public static org.hl7.fhir.r4.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Communication tgt = new org.hl7.fhir.r4.model.Communication(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setSender(VersionConvertor_10_40.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.r4.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_40.convertReference(src.getSender())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_40.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_40.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; + case NOTDONE: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; + default: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ONHOLD; + case REJECTED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; + case FAILED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE; + default: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CommunicationRequest10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CommunicationRequest10_40.java new file mode 100644 index 000000000..e5bc3a96e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/CommunicationRequest10_40.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CommunicationRequest10_40 { + + public static org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_40.convertReference(src.getSender())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequester(VersionConvertor_10_40.convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setScheduled(VersionConvertor_10_40.convertType(src.getOccurrence())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequestedOn(src.getAuthoredOn()); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CommunicationRequest tgt = new org.hl7.fhir.r4.model.CommunicationRequest(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setSender(VersionConvertor_10_40.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequester(VersionConvertor_10_40.convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setOccurrence(VersionConvertor_10_40.convertType(src.getScheduled())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setAuthoredOn(src.getRequestedOn()); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_40.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_40.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case PLANNED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case REQUESTED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case RECEIVED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ACCEPTED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case INPROGRESS: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ONHOLD; + case REJECTED: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; + default: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) { + org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); + switch(priority) { + case ROUTINE: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); + break; + case URGENT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); + break; + case STAT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); + break; + case ASAP: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); + break; + default: + return null; + } + return cc; + } + + static public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { + for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP; + } + return null; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Composition10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Composition10_40.java new file mode 100644 index 000000000..d9a1c7f7e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Composition10_40.java @@ -0,0 +1,208 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Composition10_40 { + + public static org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setConfidentiality(src.getConfidentiality().toCode()); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + try { + tgt.setConfidentiality(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_40.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_40.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_40.convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(VersionConvertor_10_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_40.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_40.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_40.convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(VersionConvertor_10_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_40.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_40.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java new file mode 100644 index 000000000..e3eb4619e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java @@ -0,0 +1,234 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CanonicalType; +import org.hl7.fhir.r4.model.ConceptMap; +import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap10_40 { + + public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r4.model.Type r = VersionConvertor_10_40.convertType(src.getSource()); + tgt.setSource(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r); + r = VersionConvertor_10_40.convertType(src.getTarget()); + tgt.setTarget(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r); + for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_10_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_10_40.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_10_40.convertType(src.getTarget())); + for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new VersionConvertor_10_40.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Condition10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Condition10_40.java new file mode 100644 index 000000000..1f1141ab9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Condition10_40.java @@ -0,0 +1,156 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Condition10_40 { + + public static org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.r4.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setAsserter(VersionConvertor_10_40.convertReference(src.getAsserter())); + if (src.hasRecordedDate()) + tgt.setDateRecorded(src.getRecordedDate()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_40.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_40.convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Condition tgt = new org.hl7.fhir.r4.model.Condition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setAsserter(VersionConvertor_10_40.convertReference(src.getAsserter())); + if (src.hasDateRecorded()) + tgt.setRecordedDate(src.getDateRecorded()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_40.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_40.convertType(src.getAbatement())); + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_40.convertCodeableConcept(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); + return cc; + } + + static public String convertConditionClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + for (org.hl7.fhir.r4.model.Coding c : src.getCoding()) { + if ("http://hl7.org/fhir/condition-clinical".equals(c.getSystem())) + return c.getCode(); + } + return null; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.addCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode()) tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(cc)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_40.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_40.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); + switch(src) { + case PROVISIONAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); + return cc; + default: + return null; + } + } + + static public org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java new file mode 100644 index 000000000..5f09050ea --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java @@ -0,0 +1,657 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent; +import org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction; + +public class Conformance10_40 { + + public static org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); + VersionConvertor_10_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + 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())); + for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_10_40.convertCanonicalToReference(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + 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())); + 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)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_10_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_10_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType()); + VersionConvertor_10_40.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r4.model.Extension("code", VersionConvertor_10_40.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); + org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); + VersionConvertor_10_40.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r4.model.Extension("request", VersionConvertor_10_40.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("response", VersionConvertor_10_40.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_40.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_40.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_10_40.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_10_40.convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_40.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_40.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DataElement10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DataElement10_40.java new file mode 100644 index 000000000..f0f474f61 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DataElement10_40.java @@ -0,0 +1,81 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; + +import java.util.ArrayList; +import java.util.List; + +public class DataElement10_40 { + + public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.getSnapshot().addElement(VersionConvertor_10_40.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DetectedIssue10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DetectedIssue10_40.java new file mode 100644 index 000000000..23fd559c9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DetectedIssue10_40.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DetectedIssue10_40 { + + public static org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_40.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(VersionConvertor_10_40.convertDateTime(src.getIdentifiedDateTimeType())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_40.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setIdentified(VersionConvertor_10_40.convertDateTime(src.getDateElement())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_40.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_40.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceMetric10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceMetric10_40.java new file mode 100644 index 000000000..6723e1b60 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceMetric10_40.java @@ -0,0 +1,247 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceMetric10_40 { + + public static org.hl7.fhir.r4.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DeviceMetric tgt = new org.hl7.fhir.r4.model.DeviceMetric(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setUnit(VersionConvertor_10_40.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_40.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_40.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r4.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setUnit(VersionConvertor_10_40.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_40.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_40.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceUseStatement10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceUseStatement10_40.java new file mode 100644 index 000000000..1729e2a80 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DeviceUseStatement10_40.java @@ -0,0 +1,41 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Annotation; + +public class DeviceUseStatement10_40 { + + public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setBodySite(VersionConvertor_10_40.convertType(src.getBodySite())); + tgt.setDevice(VersionConvertor_10_40.convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addIndication(VersionConvertor_10_40.convertCodeableConcept(t)); + for (Annotation t : src.getNote()) tgt.addNotes(t.getText()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_40.convertType(src.getTiming())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + if (src.hasBodySiteCodeableConcept()) + tgt.setBodySite(VersionConvertor_10_40.convertCodeableConcept(src.getBodySiteCodeableConcept())); + tgt.setDevice(VersionConvertor_10_40.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) tgt.addNote().setText(t.getValue()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_40.convertType(src.getTiming())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DiagnosticReport10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DiagnosticReport10_40.java new file mode 100644 index 000000000..5af988242 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DiagnosticReport10_40.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DiagnosticReport10_40 { + + public static org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getConclusionCode()) tgt.addCodedDiagnosis(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_40.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DiagnosticReport tgt = new org.hl7.fhir.r4.model.DiagnosticReport(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addMedia(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addConclusionCode(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_40.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_40.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_40.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DocumentReference10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DocumentReference10_40.java new file mode 100644 index 000000000..49ad16c3d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/DocumentReference10_40.java @@ -0,0 +1,242 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus; + +public class DocumentReference10_40 { + + static public CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { + CodeableConcept cc = new CodeableConcept(); + switch(docStatus) { + case AMENDED: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); + break; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); + break; + case FINAL: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("final"); + break; + case PRELIMINARY: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); + break; + default: + return null; + } + return cc; + } + + static public ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { + if (VersionConvertor_10_40.hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return ReferredDocumentStatus.PRELIMINARY; + if (VersionConvertor_10_40.hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return ReferredDocumentStatus.FINAL; + if (VersionConvertor_10_40.hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return ReferredDocumentStatus.AMENDED; + if (VersionConvertor_10_40.hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return ReferredDocumentStatus.ENTEREDINERROR; + return null; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_40.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setCustodian(VersionConvertor_10_40.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_40.convertReference(src.getAuthenticator())); + tgt.setCreated(src.getDate()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_40.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getClass_())); + tgt.setCustodian(VersionConvertor_10_40.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_40.convertReference(src.getAuthenticator())); + tgt.setDate(src.getCreated()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_40.convertAttachment(src.getAttachment())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) tgt.setFormat(VersionConvertor_10_40.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_40.convertAttachment(src.getAttachment())); + tgt.addFormat(VersionConvertor_10_40.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.addEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_40.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_40.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_40.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_40.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_40.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_40.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r4.model.Reference t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_40.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Reference tgt = VersionConvertor_10_40.convertReference(src.getRef()); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Encounter10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Encounter10_40.java new file mode 100644 index 000000000..e9ca08eb0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Encounter10_40.java @@ -0,0 +1,258 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Encounter10_40 { + + public static org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_40.convertCodeableConcept(src.getPriority())); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(VersionConvertor_10_40.convertReference(src.getAppointmentFirstRep())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_40.convertDuration(src.getLength())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_40.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_40.convertCodeableConcept(src.getPriority())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.addAppointment(VersionConvertor_10_40.convertReference(src.getAppointment())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_40.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_40.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPATIENT: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); + case OUTPATIENT: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case AMBULATORY: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case EMERGENCY: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); + case HOME: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); + case FIELD: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); + case DAYTIME: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); + case VIRTUAL: + return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); + default: + return null; + } + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src.getSystem().equals("http://terminology.hl7.org/v3/ActCode")) { + if (src.getCode().equals("IMP")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; + if (src.getCode().equals("AMB")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; + if (src.getCode().equals("EMER")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; + if (src.getCode().equals("HH")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; + if (src.getCode().equals("FLD")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; + if (src.getCode().equals("")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; + if (src.getCode().equals("VR")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; + } + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_40.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_40.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_40.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_40.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_40.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_40.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_40.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_40.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_40.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_40.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_40.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_40.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; + case ARRIVED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; + case FINISHED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; + } + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; + case INPROGRESS: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; + default: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentRequest10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentRequest10_40.java new file mode 100644 index 000000000..6ad6f1709 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentRequest10_40.java @@ -0,0 +1,31 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentRequest10_40 { + + public static org.hl7.fhir.r4.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.EnrollmentRequest tgt = new org.hl7.fhir.r4.model.EnrollmentRequest(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setProvider(VersionConvertor_10_40.convertReference(src.getProvider())); + tgt.setCandidate(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setCoverage(VersionConvertor_10_40.convertReference(src.getCoverage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r4.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setCoverage(VersionConvertor_10_40.convertReference(src.getCoverage())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentResponse10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentResponse10_40.java new file mode 100644 index 000000000..514a30fd2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EnrollmentResponse10_40.java @@ -0,0 +1,32 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentResponse10_40 { + + public static org.hl7.fhir.r4.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.EnrollmentResponse tgt = new org.hl7.fhir.r4.model.EnrollmentResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setRequest(VersionConvertor_10_40.convertReference(src.getRequest())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + tgt.setOrganization(VersionConvertor_10_40.convertReference(src.getOrganization())); + tgt.setRequestProvider(VersionConvertor_10_40.convertReference(src.getRequestProvider())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r4.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EpisodeOfCare10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EpisodeOfCare10_40.java new file mode 100644 index 000000000..ef9a93c7f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/EpisodeOfCare10_40.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class EpisodeOfCare10_40 { + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r4.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_40.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_40.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare tgt = new org.hl7.fhir.r4.model.EpisodeOfCare(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_40.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_40.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/FamilyMemberHistory10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/FamilyMemberHistory10_40.java new file mode 100644 index 000000000..c7cf3f5af --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/FamilyMemberHistory10_40.java @@ -0,0 +1,101 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class FamilyMemberHistory10_40 { + + public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_40.convertCodeableConcept(src.getRelationship())); + tgt.setBorn(VersionConvertor_10_40.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_40.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_40.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_40.convertCodeableConcept(src.getRelationship())); + tgt.setBorn(VersionConvertor_10_40.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_40.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_40.convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_40.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnset())); + return tgt; + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_40.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnset())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Flag10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Flag10_40.java new file mode 100644 index 000000000..67ab4a5e6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Flag10_40.java @@ -0,0 +1,69 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Flag10_40 { + + public static org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Flag tgt = new org.hl7.fhir.r4.model.Flag(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.r4.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r4.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r4.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Flag.FlagStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Group10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Group10_40.java new file mode 100644 index 000000000..99c7124c9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Group10_40.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Group10_40 { + + public static org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Group tgt = new org.hl7.fhir.r4.model.Group(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.r4.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r4.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r4.model.Group.GroupMemberComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_40.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r4.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_40.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.r4.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.r4.model.Group.GroupType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/HealthcareService10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/HealthcareService10_40.java new file mode 100644 index 000000000..4848a138b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/HealthcareService10_40.java @@ -0,0 +1,160 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class HealthcareService10_40 { + + public static org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HealthcareService tgt = new org.hl7.fhir.r4.model.HealthcareService(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_40.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { + for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) tgt.addSpecialty(VersionConvertor_10_40.convertCodeableConcept(tj)); + } + tgt.addLocation(VersionConvertor_10_40.convertReference(src.getLocation())); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_40.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_40.convertCodeableConcept(t)); + if (src.hasEligibility()) + tgt.getEligibilityFirstRep().setCode(VersionConvertor_10_40.convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + tgt.getEligibilityFirstRep().setComment(src.getEligibilityNote()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.r4.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_40.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) { + if (!tgt.hasServiceType()) + tgt.addServiceType(); + tgt.getServiceType().get(0).addSpecialty(VersionConvertor_10_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) tgt.setLocation(VersionConvertor_10_40.convertReference(t)); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_40.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setEligibility(VersionConvertor_10_40.convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgram()) if (t.hasText()) + tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_40.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_40.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ImplementationGuide10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ImplementationGuide10_40.java new file mode 100644 index 000000000..b731301c8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ImplementationGuide10_40.java @@ -0,0 +1,257 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Enumeration; +import org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration; + +import java.util.List; + +public class ImplementationGuide10_40 { + + public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_10_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) + tgt.setExampleFor(VersionConvertor_10_40.convertCanonicalToReference(src.getExampleCanonicalType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_10_40.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasExampleFor()) + tgt.setExample(VersionConvertor_10_40.convertReferenceToCanonical(src.getExampleFor())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_10_40.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasSource()) { + tgt.setName(convertUriToUrl(src.getSourceElement())); + } + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch(generation) { + case HTML: + return GuidePageKind.PAGE; + default: + return GuidePageKind.RESOURCE; + } + } + + static public GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch(kind) { + case PAGE: + return GuidePageGeneration.HTML; + default: + return GuidePageGeneration.GENERATED; + } + } + + public static org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); + VersionConvertor_10_40.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + if (id != null) + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (id.equals(t.getId())) + return t; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/List10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/List10_40.java new file mode 100644 index 000000000..79b71b57c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/List10_40.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class List10_40 { + + public static org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_40.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_40.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_40.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_40.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_40.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_40.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; + default: + return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + } + } + + public static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_40.convertExtension(e)); + } + } + + public static void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_40.convertExtension(e)); + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Location10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Location10_40.java new file mode 100644 index 000000000..3adbabbc7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Location10_40.java @@ -0,0 +1,125 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Location10_40 { + + public static org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.r4.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_40.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Location tgt = new org.hl7.fhir.r4.model.Location(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.addType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_40.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.r4.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.r4.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r4.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r4.model.Location.LocationPositionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r4.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationDispense10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationDispense10_40.java new file mode 100644 index 000000000..01bf4eec5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationDispense10_40.java @@ -0,0 +1,132 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Dosage; +import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent; + +public class MedicationDispense10_40 { + + public static org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_40.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_40.convertReference(t)); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_40.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_40.convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_40.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_40.convertReference(t)); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_40.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_40.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_40.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_40.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_40.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(VersionConvertor_10_40.convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(VersionConvertor_10_40.convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(VersionConvertor_10_40.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_40.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_40.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_40.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_40.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(VersionConvertor_10_40.convertType(src.getDoseAndRate().get(0).getDose())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_40.convertRatio(src.getMaxDosePerPeriod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(VersionConvertor_10_40.convertType(src.getDoseAndRate().get(0).getRate())); + return tgt; + } + + public static String convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_10_40.convertReference(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationStatement10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationStatement10_40.java new file mode 100644 index 000000000..cea00448b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationStatement10_40.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent; + +public class MedicationStatement10_40 { + + public static org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_40.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_40.convertReference(src.getInformationSource())); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) tgt.addSupportingInformation(VersionConvertor_10_40.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_40.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_40.convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) tgt.addDerivedFrom(VersionConvertor_10_40.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_40.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_40.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_40.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_40.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + if (src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasRate()) + dr.setRate(VersionConvertor_10_40.convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(VersionConvertor_10_40.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_40.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_40.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_40.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_40.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(VersionConvertor_10_40.convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_40.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MessageHeader10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MessageHeader10_40.java new file mode 100644 index 000000000..caaa83931 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MessageHeader10_40.java @@ -0,0 +1,142 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageHeader10_40 { + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setEvent(VersionConvertor_10_40.convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_40.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setResponsible(VersionConvertor_10_40.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_40.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) tgt.addFocus(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_10_40.convertCoding(src.getEventCoding())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_40.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setResponsible(VersionConvertor_10_40.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_40.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) tgt.addData(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_40.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_40.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_40.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_40.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; + } + } + + public static org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/NamingSystem10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/NamingSystem10_40.java new file mode 100644 index 000000000..31de56b23 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/NamingSystem10_40.java @@ -0,0 +1,162 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem10_40 { + + public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Observation10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Observation10_40.java new file mode 100644 index 000000000..86fbceb45 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Observation10_40.java @@ -0,0 +1,174 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Observation10_40 { + + public static org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory()) tgt.setCategory(VersionConvertor_10_40.convertCodeableConcept(c)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_40.convertReference(t)); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_40.convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(VersionConvertor_10_40.convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComments(src.getNoteFirstRep().getText()); + tgt.setBodySite(VersionConvertor_10_40.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_40.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_40.convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHasMember()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_40.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_40.convertReference(t)); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_40.convertCodeableConcept(src.getDataAbsentReason())); + tgt.addInterpretation(VersionConvertor_10_40.convertCodeableConcept(src.getInterpretation())); + tgt.addNote().setText(src.getComments()); + tgt.setBodySite(VersionConvertor_10_40.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_40.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_40.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(VersionConvertor_10_40.convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(VersionConvertor_10_40.convertReference(t.getTarget())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_40.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_40.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_40.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_40.convertSimpleQuantity(src.getHigh())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getMeaning())); + tgt.setAge(VersionConvertor_10_40.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_40.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_40.convertSimpleQuantity(src.getHigh())); + tgt.setMeaning(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setAge(VersionConvertor_10_40.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Reference src, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(VersionConvertor_10_40.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationDefinition10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationDefinition10_40.java new file mode 100644 index 000000000..240e4eb9f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationDefinition10_40.java @@ -0,0 +1,222 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.dstu2.model.Reference; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Enumerations.SearchParamType; +import org.hl7.fhir.r4.model.Type; +import org.hl7.fhir.utilities.Utilities; + +public class OperationDefinition10_40 { + + public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBaseElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_10_40.convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_40.convertBindingStrength(src.getStrength())); + Type t = VersionConvertor_10_40.convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r4.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_40.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + } else + tgt.setType(src.getType()); + for (org.hl7.fhir.r4.model.UriType t : src.getTargetProfile()) tgt.setProfile(new Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { + tgt.setType("string"); + tgt.setSearchType(SearchParamType.fromCode(src.getType())); + } else { + tgt.setType(src.getType()); + } + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationOutcome10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationOutcome10_40.java new file mode 100644 index 000000000..2498e87f8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/OperationOutcome10_40.java @@ -0,0 +1,219 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome10_40 { + + public static org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_40.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_40.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Organization10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Organization10_40.java new file mode 100644 index 000000000..627857558 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Organization10_40.java @@ -0,0 +1,63 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Organization10_40 { + + public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_40.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_40.convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_40.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_40.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Parameters10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Parameters10_40.java new file mode 100644 index 000000000..1e5b3274b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Parameters10_40.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters10_40 { + + public static org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); + VersionConvertor_10_40.copyResource(src, tgt); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + VersionConvertor_10_40.copyResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_40.convertResource(src.getResource())); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_40.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Patient10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Patient10_40.java new file mode 100644 index 000000000..6f000ae74 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Patient10_40.java @@ -0,0 +1,190 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Patient10_40 { + + public static org.hl7.fhir.r4.model.Extension convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", VersionConvertor_10_40.convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", VersionConvertor_10_40.convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", VersionConvertor_10_40.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(VersionConvertor_10_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(VersionConvertor_10_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(VersionConvertor_10_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_40.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_40.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_40.convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_40.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_40.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACE: + return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; + case REFER: + return org.hl7.fhir.r4.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.r4.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REPLACES: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REFER: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient tgt = new org.hl7.fhir.r4.model.Patient(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_40.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_40.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_40.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_40.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_40.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) tgt.addGeneralPractitioner(VersionConvertor_10_40.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.r4.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_40.convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_40.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_40.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_40.convertAttachment(t)); + for (org.hl7.fhir.r4.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGeneralPractitioner()) tgt.addCareProvider(VersionConvertor_10_40.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r4.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_40.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_40.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r4.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_40.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_40.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Person10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Person10_40.java new file mode 100644 index 000000000..161af4be8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Person10_40.java @@ -0,0 +1,97 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Person10_40 { + + public static org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Person tgt = new org.hl7.fhir.r4.model.Person(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_40.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_40.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.r4.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_40.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_40.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r4.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r4.model.Person.PersonLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_40.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Practitioner10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Practitioner10_40.java new file mode 100644 index 000000000..8867911ee --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Practitioner10_40.java @@ -0,0 +1,68 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Practitioner10_40 { + + public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.setName(VersionConvertor_10_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_40.convertAttachment(t)); + for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setActive(src.getActive()); + if (src.hasName()) + tgt.addName(VersionConvertor_10_40.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_40.convertAddress(t)); + tgt.setGender(VersionConvertor_10_40.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_40.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_40.convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_40.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_40.convertReference(src.getIssuer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java new file mode 100644 index 000000000..fee945e75 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java @@ -0,0 +1,241 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.ContactDetail; +import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; + +public class Questionnaire10_40 { + + public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t1)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); + root.setTitle(src.getTitle()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) { + root.addConcept(VersionConvertor_10_40.convertCoding(t)); + } + for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP) + root.addGroup(convertQuestionnaireGroupComponent(t)); + else + root.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); + tgt.setTitle(root.getTitle()); + for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + tgt.addItem(convertQuestionnaireGroupComponent(root)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + else + tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; + case STRING: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; + case TEXT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; + case URL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; + case CHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(VersionConvertor_10_40.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) if (t.hasValueCoding()) + try { + tgt.addOption(VersionConvertor_10_40.convertCoding(t.getValueCoding())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setAnswerValueSetElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) tgt.addAnswerOption().setValue(VersionConvertor_10_40.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/QuestionnaireResponse10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/QuestionnaireResponse10_40.java new file mode 100644 index 000000000..b03e77104 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/QuestionnaireResponse10_40.java @@ -0,0 +1,142 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse10_40 { + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_10_40.convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + if (src.getItem().size() != 1) + throw new FHIRException("multiple root items not supported"); + tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_40.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_40.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + if (src.hasGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/RiskAssessment10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/RiskAssessment10_40.java new file mode 100644 index 000000000..475324684 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/RiskAssessment10_40.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class RiskAssessment10_40 { + + public static org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_40.convertReference(src.getCondition())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_40.convertReference(src.getPerformer())); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_40.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_40.convertReference(src.getCondition())); + tgt.setEncounter(VersionConvertor_10_40.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_40.convertReference(src.getPerformer())); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_40.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_40.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_40.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_40.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_40.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_40.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Schedule10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Schedule10_40.java new file mode 100644 index 000000000..300abde75 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Schedule10_40.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Schedule10_40 { + + public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addServiceType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.addActor(VersionConvertor_10_40.convertReference(src.getActor())); + tgt.setPlanningHorizon(VersionConvertor_10_40.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.addType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_40.convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(VersionConvertor_10_40.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SearchParameter10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SearchParameter10_40.java new file mode 100644 index 000000000..9ce6e5261 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SearchParameter10_40.java @@ -0,0 +1,118 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.dstu2.utils.ToolingExtensions; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter10_40 { + + public static org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_10_40.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_10_40.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Slot10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Slot10_40.java new file mode 100644 index 000000000..791ec40f5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Slot10_40.java @@ -0,0 +1,38 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Slot10_40 { + + public static org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setSchedule(VersionConvertor_10_40.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setSchedule(VersionConvertor_10_40.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/StructureDefinition10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/StructureDefinition10_40.java new file mode 100644 index 000000000..d567e16fd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/StructureDefinition10_40.java @@ -0,0 +1,294 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.ElementDefinition; +import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.utilities.Utilities; + +import java.util.ArrayList; +import java.util.List; + +public class StructureDefinition10_40 { + + static public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource102(tn)) { + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_10_40.convertCoding(t)); + tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) { + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + tgt.getType()); + tgt.setType(tgt.getId()); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_10_40.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_40.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_40.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_40.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_40.convertElementDefinition(t)); + return tgt; + } + + static public boolean isResource102(String tn) { + return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", "MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance", "SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription"); + } + + static public String tail(String base) { + return base.substring(base.lastIndexOf("/") + 1); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Subscription10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Subscription10_40.java new file mode 100644 index 000000000..d68064679 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Subscription10_40.java @@ -0,0 +1,134 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Subscription10_40 { + + public static org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_10_40.convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + tgt.addHeader(src.getHeader()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + if (src.hasHeader()) + tgt.setHeaderElement(VersionConvertor_10_40.convertString(src.getHeader().get(0))); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Substance10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Substance10_40.java new file mode 100644 index 000000000..ba9bb20b9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Substance10_40.java @@ -0,0 +1,76 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Substance10_40 { + + public static org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_40.convertRatio(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_40.convertRatio(src.getQuantity())); + tgt.setSubstance(VersionConvertor_10_40.convertReference(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyDelivery10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyDelivery10_40.java new file mode 100644 index 000000000..b1e3889b0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyDelivery10_40.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyDelivery10_40 { + + public static org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_40.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_40.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_40.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_40.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyRequest10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyRequest10_40.java new file mode 100644 index 000000000..10d2cead5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/SupplyRequest10_40.java @@ -0,0 +1,22 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyRequest10_40 { + + public static org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/TestScript10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/TestScript10_40.java new file mode 100644 index 000000000..322b29a02 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/TestScript10_40.java @@ -0,0 +1,611 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestScript10_40 { + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return "application/fhir+xml"; + case JSON: + return "application/fhir+json"; + default: + return null; + } + } + + static public org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) + return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; + if (src.contains("json")) + return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; + return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_40.convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_40.convertReference(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_40.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_40.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r4.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setConformance(VersionConvertor_10_40.convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setCapabilitiesElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getConformance())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java new file mode 100644 index 000000000..be9b2de66 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java @@ -0,0 +1,412 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.CodeSystem; +import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r4.terminologies.CodeSystemUtilities; + +import java.util.List; + +public class ValueSet10_40 { + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem(); + VersionConvertor_10_40.copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.addIdentifier(VersionConvertor_10_40.convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName() + " Code System"); + tgtcs.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_40.isJurisdiction(t)) + tgtcs.addJurisdiction(VersionConvertor_10_40.convertCodeableConcept(t)); + else + tgtcs.addUseContext(VersionConvertor_10_40.convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src, VersionConvertorAdvisor40 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); + VersionConvertor_10_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_40.convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_40.convertType(src.getValue())); + return tgt; + } + + static public void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_40.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs); + } + + static public void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_40.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java new file mode 100644 index 000000000..d9fa59ce6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java @@ -0,0 +1,180 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Appointment10_50 { + + public static org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_50.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_10_50.convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_50.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_50.convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; + default: + return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AppointmentResponse10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AppointmentResponse10_50.java new file mode 100644 index 000000000..0e10c8a31 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AppointmentResponse10_50.java @@ -0,0 +1,77 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class AppointmentResponse10_50 { + + public static org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_50.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_50.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setAppointment(VersionConvertor_10_50.convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_50.convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; + case INPROCESS: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case NEEDSACTION: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AuditEvent10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AuditEvent10_50.java new file mode 100644 index 000000000..55f02e206 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/AuditEvent10_50.java @@ -0,0 +1,306 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class AuditEvent10_50 { + + public static org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.getEvent().setType(VersionConvertor_10_50.convertCoding(src.getType())); + for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) tgt.getEvent().addSubtype(VersionConvertor_10_50.convertCoding(t)); + tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setDateTime(src.getRecorded()); + tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) tgt.getEvent().addPurposeOfEvent(VersionConvertor_10_50.convertCoding(cc)); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addParticipant(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addObject(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + if (src.hasEvent()) { + tgt.setType(VersionConvertor_10_50.convertCoding(src.getEvent().getType())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) tgt.addSubtype(VersionConvertor_10_50.convertCoding(t)); + tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setRecorded(src.getEvent().getDateTime()); + tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) tgt.addPurposeOfEvent().addCoding(VersionConvertor_10_50.convertCoding(t)); + } + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) tgt.addAgent(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_50.convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(VersionConvertor_10_50.convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(VersionConvertor_10_50.convertReference(src.getWho())); + } + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_50.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) tgt.addPurposeOfUse(VersionConvertor_10_50.convertCoding(cc)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setWho(VersionConvertor_10_50.convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + tgt.setMedia(VersionConvertor_10_50.convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) tgt.addPurposeOfUse().addCoding(VersionConvertor_10_50.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(VersionConvertor_10_50.convertReference(src.getReference())); + tgt.setType(VersionConvertor_10_50.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_50.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_50.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_50.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(VersionConvertor_10_50.convertReference(src.getWhat())); + } + tgt.setType(VersionConvertor_10_50.convertCoding(src.getType())); + tgt.setRole(VersionConvertor_10_50.convertCoding(src.getRole())); + tgt.setLifecycle(VersionConvertor_10_50.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_50.convertCoding(t)); + tgt.setName(src.getName()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; + case _2: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; + case _3: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; + case _4: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; + case _5: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; + default: + return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCoding(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Basic10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Basic10_50.java new file mode 100644 index 000000000..cb3e19fe9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Basic10_50.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Basic10_50 { + + public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Binary10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Binary10_50.java new file mode 100644 index 000000000..d951416c7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Binary10_50.java @@ -0,0 +1,27 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Binary10_50 { + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + VersionConvertor_10_50.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); + VersionConvertor_10_50.copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java new file mode 100644 index 000000000..682047ce8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor50; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle10_50 { + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + VersionConvertor_10_50.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_10_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + return convertBundle(src, null); + } + + public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); + VersionConvertor_10_50.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t, advisor)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_10_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_10_50.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (advisor.ignoreEntry(src)) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource()); + if (res == null) + res = VersionConvertor_10_50.convertResource(src.getResource()); + tgt.setResource(res); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + return convertBundleEntryComponent(src, null); + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java new file mode 100644 index 000000000..1c5d26602 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java @@ -0,0 +1,206 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.dstu2.model.Reference; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class CarePlan10_50 { + + public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getContext())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) if (!tgt.hasAuthor()) + tgt.setAuthor(VersionConvertor_10_50.convertReference(t)); + else + tgt.addContributor(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) tgt.addAddresses(convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + if (src.hasAuthor()) + tgt.addAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) tgt.addAuthor(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (CodeableReference t : src.getAddresses()) { + if (t.hasReference()) { + tgt.addAddresses(VersionConvertor_10_50.convertReference(t.getReference())); + } + } + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_50.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_50.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_50.convertAnnotation(t)); + tgt.setReference(VersionConvertor_10_50.convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_10_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) tgt.addReason(convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_50.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setDoNotPerform(src.getProhibited()); + tgt.setScheduled(VersionConvertor_10_50.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_50.convertReference(t)); + tgt.setProduct(VersionConvertor_10_50.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_50.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_10_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_10_50.convertReference(t.getReference())); + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_50.convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setProhibited(src.getDoNotPerform()); + tgt.setScheduled(VersionConvertor_10_50.convertType(src.getScheduled())); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_50.convertReference(t)); + tgt.setProduct(VersionConvertor_10_50.convertType(src.getProduct())); + tgt.setDailyAmount(VersionConvertor_10_50.convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSTARTED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; + case REVOKED: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED; + default: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; + } + } + + static public CodeableReference convertReferenceToCodableReference(Reference src) { + CodeableReference tgt = new CodeableReference(); + tgt.setReference(VersionConvertor_10_50.convertReference(src)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Communication10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Communication10_50.java new file mode 100644 index 000000000..0313ab75d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Communication10_50.java @@ -0,0 +1,105 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Communication10_50 { + + public static org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.setSender(VersionConvertor_10_50.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_50.convertCodeableConceptToCodableReference(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_50.convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReason(VersionConvertor_10_50.convertCodeableConcept(t.getConcept())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_50.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_50.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; + case NOTDONE: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; + default: + return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.EventStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.ONHOLD; + case REJECTED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; + case FAILED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE; + default: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CommunicationRequest10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CommunicationRequest10_50.java new file mode 100644 index 000000000..0b178b26c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CommunicationRequest10_50.java @@ -0,0 +1,152 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class CommunicationRequest10_50 { + + public static org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r5.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(VersionConvertor_10_50.convertReference(src.getInformationProviderFirstRep())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setRequester(VersionConvertor_10_50.convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setScheduled(VersionConvertor_10_50.convertType(src.getOccurrence())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReason(VersionConvertor_10_50.convertCodeableConcept(t.getConcept())); + tgt.setRequestedOn(src.getAuthoredOn()); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CommunicationRequest tgt = new org.hl7.fhir.r5.model.CommunicationRequest(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.addInformationProvider(VersionConvertor_10_50.convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setRequester(VersionConvertor_10_50.convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setOccurrence(VersionConvertor_10_50.convertType(src.getScheduled())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_50.convertCodeableConceptToCodableReference(t)); + tgt.setAuthoredOn(src.getRequestedOn()); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_50.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setContent(VersionConvertor_10_50.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; + default: + return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; + case PLANNED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case REQUESTED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case RECEIVED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case ACCEPTED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case INPROGRESS: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; + case SUSPENDED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD; + case REJECTED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.RequestPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { + for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP; + } + return null; + } + + static public org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r5.model.Enumerations.RequestPriority priority) { + org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); + switch(priority) { + case ROUTINE: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); + break; + case URGENT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); + break; + case STAT: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); + break; + case ASAP: + cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); + break; + default: + return null; + } + return cc; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Composition10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Composition10_50.java new file mode 100644 index 000000000..4bcdad11b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Composition10_50.java @@ -0,0 +1,208 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Composition10_50 { + + public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + try { + tgt.setConfidentiality(org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.fromCode(src.getConfidentiality())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setConfidentiality(src.getConfidentiality().toCode()); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(VersionConvertor_10_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_50.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + tgt.setTime(src.getTime()); + tgt.setParty(VersionConvertor_10_50.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_50.convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(VersionConvertor_10_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_50.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_50.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setText(VersionConvertor_10_50.convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.r5.model.Enumerations.ListMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(VersionConvertor_10_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_10_50.convertReference(t)); + tgt.setEmptyReason(VersionConvertor_10_50.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java new file mode 100644 index 000000000..d058e371a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java @@ -0,0 +1,234 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.ConceptMap; +import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap10_50 { + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r5.model.DataType r = VersionConvertor_10_50.convertType(src.getSource()); + tgt.setSource(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); + r = VersionConvertor_10_50.convertType(src.getTarget()); + tgt.setTarget(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); + for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_10_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) { + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + } + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_10_50.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_10_50.convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case BROADER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; + case NARROWER: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; + case NOTRELATEDTO: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case WIDER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case SUBSUMES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case NARROWER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case INEXACT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; + case UNMATCHED: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + case DISJOINT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; + default: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + if (src.hasNoMap() && src.getNoMap() == true) { + tgt.addTarget(new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); + } else { + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + } + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (t.getEquivalence() == org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { + tgt.setNoMap(true); + } else { + tgt.addTarget(convertTargetElementComponent(t)); + } + res.add(new VersionConvertor_10_50.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Condition10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Condition10_50.java new file mode 100644 index 000000000..988f4021f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Condition10_50.java @@ -0,0 +1,156 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Condition10_50 { + + public static org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setAsserter(VersionConvertor_10_50.convertReference(src.getAsserter())); + if (src.hasRecordedDate()) + tgt.setDateRecorded(src.getRecordedDate()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_50.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_50.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_50.convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setAsserter(VersionConvertor_10_50.convertReference(src.getAsserter())); + if (src.hasDateRecorded()) + tgt.setRecordedDate(src.getDateRecorded()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(VersionConvertor_10_50.convertCodeableConcept(src.getSeverity())); + tgt.setOnset(VersionConvertor_10_50.convertType(src.getOnset())); + tgt.setAbatement(VersionConvertor_10_50.convertType(src.getAbatement())); + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_10_50.convertCodeableConcept(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); + return cc; + } + + static public String convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + for (org.hl7.fhir.r5.model.Coding c : src.getCoding()) { + if ("http://hl7.org/fhir/condition-clinical".equals(c.getSystem())) + return c.getCode(); + } + return null; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept cc : src.getCode()) tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(cc)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.addCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_50.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSummary(VersionConvertor_10_50.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch(src) { + case PROVISIONAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); + return cc; + default: + return null; + } + } + + static public org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java new file mode 100644 index 000000000..cd354c558 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java @@ -0,0 +1,660 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction; + +public class Conformance10_50 { + + public static org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); + VersionConvertor_10_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + 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())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_10_50.convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + 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())); + 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)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_10_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_10_50.convertCoding((org.hl7.fhir.r5.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + event.setCode(VersionConvertor_10_50.convertCoding((org.hl7.fhir.r5.model.Coding) e.getExtensionByUrl("code").getValue())); + org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType()); + VersionConvertor_10_50.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_10_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_10_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r5.model.Extension("code", VersionConvertor_10_50.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); + org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); + VersionConvertor_10_50.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r5.model.Extension("request", VersionConvertor_10_50.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("response", VersionConvertor_10_50.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_50.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_10_50.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_10_50.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasType()) { + tgt.setType(src.getType()); + } + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_10_50.convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_50.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_10_50.convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DataElement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DataElement10_50.java new file mode 100644 index 000000000..574cb6319 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DataElement10_50.java @@ -0,0 +1,81 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; + +import java.util.ArrayList; +import java.util.List; + +public class DataElement10_50 { + + public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.getSnapshot().addElement(VersionConvertor_10_50.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DetectedIssue10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DetectedIssue10_50.java new file mode 100644 index 000000000..0e51ca176 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DetectedIssue10_50.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DetectedIssue10_50 { + + public static org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_50.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(VersionConvertor_10_50.convertDateTime(src.getIdentifiedDateTimeType())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_50.convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setIdentified(VersionConvertor_10_50.convertDateTime(src.getDateElement())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_50.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAction(VersionConvertor_10_50.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceMetric10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceMetric10_50.java new file mode 100644 index 000000000..54393e0b5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceMetric10_50.java @@ -0,0 +1,247 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceMetric10_50 { + + public static org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setUnit(VersionConvertor_10_50.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_50.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_50.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setUnit(VersionConvertor_10_50.convertCodeableConcept(src.getUnit())); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setParent(VersionConvertor_10_50.convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(VersionConvertor_10_50.convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTCALIBRATED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNSPECIFIED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MEASUREMENT: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BLACK: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ON: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: + return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java new file mode 100644 index 000000000..1dfce2dd2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java @@ -0,0 +1,43 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Annotation; +import org.hl7.fhir.r5.model.CodeableReference; + +public class DeviceUseStatement10_50 { + + public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + if (src.hasBodySiteCodeableConcept()) + tgt.setBodySite(VersionConvertor_10_50.convertCodeableConcept(src.getBodySiteCodeableConcept())); + tgt.setDevice(VersionConvertor_10_50.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) tgt.addReason(VersionConvertor_10_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) tgt.addNote().setText(t.getValue()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_50.convertType(src.getTiming())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setBodySite(VersionConvertor_10_50.convertType(src.getBodySite())); + tgt.setDevice(VersionConvertor_10_50.convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addIndication(VersionConvertor_10_50.convertCodeableConcept(t.getConcept())); + for (Annotation t : src.getNote()) tgt.addNotes(t.getText()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setTiming(VersionConvertor_10_50.convertType(src.getTiming())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DiagnosticReport10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DiagnosticReport10_50.java new file mode 100644 index 000000000..5e7c30c84 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DiagnosticReport10_50.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DiagnosticReport10_50 { + + public static org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addMedia(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addConclusionCode(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_50.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) tgt.addCodedDiagnosis(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_10_50.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_50.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(VersionConvertor_10_50.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DocumentReference10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DocumentReference10_50.java new file mode 100644 index 000000000..1a5b91fa4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DocumentReference10_50.java @@ -0,0 +1,241 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.exceptions.FHIRException; + +public class DocumentReference10_50 { + + static public CodeableConcept convertDocStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus docStatus) { + CodeableConcept cc = new CodeableConcept(); + switch(docStatus) { + case AMENDED: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); + break; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); + break; + case FINAL: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("final"); + break; + case PRELIMINARY: + cc.addCoding().setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); + break; + default: + return null; + } + return cc; + } + + static public org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertDocStatus(CodeableConcept cc) { + if (VersionConvertor_10_50.hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; + if (VersionConvertor_10_50.hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; + if (VersionConvertor_10_50.hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; + if (VersionConvertor_10_50.hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; + return null; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_50.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setClass_(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setCustodian(VersionConvertor_10_50.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_50.convertReference(src.getAuthenticator())); + tgt.setCreated(src.getDate()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setMasterIdentifier(VersionConvertor_10_50.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getClass_())); + tgt.setCustodian(VersionConvertor_10_50.convertReference(src.getCustodian())); + tgt.setAuthenticator(VersionConvertor_10_50.convertReference(src.getAuthenticator())); + tgt.setDate(src.getCreated()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_50.convertAttachment(src.getAttachment())); + tgt.addFormat(VersionConvertor_10_50.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAttachment(VersionConvertor_10_50.convertAttachment(src.getAttachment())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) tgt.setFormat(VersionConvertor_10_50.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_50.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_50.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_50.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.addEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setFacilityType(VersionConvertor_10_50.convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(VersionConvertor_10_50.convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(VersionConvertor_10_50.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = VersionConvertor_10_50.convertReference(src.getRef()); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_10_50.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Encounter10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Encounter10_50.java new file mode 100644 index 000000000..5d05d24a6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Encounter10_50.java @@ -0,0 +1,256 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Encounter10_50 { + + public static org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_50.convertCodeableConcept(src.getPriority())); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(VersionConvertor_10_50.convertReference(src.getAppointmentFirstRep())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_50.convertDuration(src.getLength())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReason(VersionConvertor_10_50.convertCodeableConcept(t.getConcept())); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_50.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPriority(VersionConvertor_10_50.convertCodeableConcept(src.getPriority())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.addAppointment(VersionConvertor_10_50.convertReference(src.getAppointment())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setLength(VersionConvertor_10_50.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_50.convertCodeableConceptToCodableReference(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(VersionConvertor_10_50.convertReference(src.getServiceProvider())); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src.getSystem().equals("http://terminology.hl7.org/v3/ActCode")) { + if (src.getCode().equals("IMP")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; + if (src.getCode().equals("AMB")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; + if (src.getCode().equals("EMER")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; + if (src.getCode().equals("HH")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; + if (src.getCode().equals("FLD")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; + if (src.getCode().equals("")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; + if (src.getCode().equals("VR")) + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; + } + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; + } + + public static org.hl7.fhir.r5.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPATIENT: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); + case OUTPATIENT: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case AMBULATORY: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case EMERGENCY: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); + case HOME: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); + case FIELD: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); + case DAYTIME: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); + case VIRTUAL: + return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); + default: + return null; + } + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_50.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_50.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_50.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_50.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_50.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(VersionConvertor_10_50.convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(VersionConvertor_10_50.convertReference(src.getOrigin())); + tgt.setAdmitSource(VersionConvertor_10_50.convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(VersionConvertor_10_50.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + tgt.setDischargeDisposition(VersionConvertor_10_50.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_50.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setIndividual(VersionConvertor_10_50.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; + case INPROGRESS: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; + } + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case INPROGRESS: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case FINISHED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; + default: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentRequest10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentRequest10_50.java new file mode 100644 index 000000000..b01d24193 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentRequest10_50.java @@ -0,0 +1,31 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentRequest10_50 { + + public static org.hl7.fhir.r5.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EnrollmentRequest tgt = new org.hl7.fhir.r5.model.EnrollmentRequest(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setProvider(VersionConvertor_10_50.convertReference(src.getProvider())); + tgt.setCandidate(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setCoverage(VersionConvertor_10_50.convertReference(src.getCoverage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r5.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCreated(src.getCreated()); + tgt.setCoverage(VersionConvertor_10_50.convertReference(src.getCoverage())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentResponse10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentResponse10_50.java new file mode 100644 index 000000000..39f19c4c7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EnrollmentResponse10_50.java @@ -0,0 +1,32 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class EnrollmentResponse10_50 { + + public static org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r5.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + return tgt; + } + + public static org.hl7.fhir.r5.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EnrollmentResponse tgt = new org.hl7.fhir.r5.model.EnrollmentResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setRequest(VersionConvertor_10_50.convertReference(src.getRequest())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + tgt.setOrganization(VersionConvertor_10_50.convertReference(src.getOrganization())); + tgt.setRequestProvider(VersionConvertor_10_50.convertReference(src.getRequestProvider())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EpisodeOfCare10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EpisodeOfCare10_50.java new file mode 100644 index 000000000..e1b3d149f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/EpisodeOfCare10_50.java @@ -0,0 +1,103 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class EpisodeOfCare10_50 { + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_50.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_50.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_10_50.convertReference(t)); + tgt.setCareManager(VersionConvertor_10_50.convertReference(src.getCareManager())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: + return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/FamilyMemberHistory10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/FamilyMemberHistory10_50.java new file mode 100644 index 000000000..13f91a06e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/FamilyMemberHistory10_50.java @@ -0,0 +1,101 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class FamilyMemberHistory10_50 { + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_50.convertCodeableConcept(src.getRelationship())); + tgt.setBorn(VersionConvertor_10_50.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_50.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_50.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(VersionConvertor_10_50.convertCodeableConcept(src.getRelationship())); + tgt.setBorn(VersionConvertor_10_50.convertType(src.getBorn())); + tgt.setAge(VersionConvertor_10_50.convertType(src.getAge())); + tgt.setDeceased(VersionConvertor_10_50.convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_50.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_50.convertType(src.getOnset())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setOutcome(VersionConvertor_10_50.convertCodeableConcept(src.getOutcome())); + tgt.setOnset(VersionConvertor_10_50.convertType(src.getOnset())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Flag10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Flag10_50.java new file mode 100644 index 000000000..2c5050367 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Flag10_50.java @@ -0,0 +1,69 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Flag10_50 { + + public static org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Group10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Group10_50.java new file mode 100644 index 000000000..95a0b4f7f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Group10_50.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Group10_50 { + + public static org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_50.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setEntity(VersionConvertor_10_50.convertReference(src.getEntity())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.r5.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.r5.model.Group.GroupType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/HealthcareService10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/HealthcareService10_50.java new file mode 100644 index 000000000..4f061d080 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/HealthcareService10_50.java @@ -0,0 +1,160 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class HealthcareService10_50 { + + public static org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.SUN; + default: + return org.hl7.fhir.r5.model.Enumerations.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_50.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) { + if (!tgt.hasServiceType()) + tgt.addServiceType(); + tgt.getServiceType().get(0).addSpecialty(VersionConvertor_10_50.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) tgt.setLocation(VersionConvertor_10_50.convertReference(t)); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_50.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setEligibility(VersionConvertor_10_50.convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgram()) if (t.hasText()) + tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setProvidedBy(VersionConvertor_10_50.convertReference(src.getProvidedBy())); + for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { + for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) tgt.addSpecialty(VersionConvertor_10_50.convertCodeableConcept(tj)); + } + tgt.addLocation(VersionConvertor_10_50.convertReference(src.getLocation())); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(VersionConvertor_10_50.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_10_50.convertCodeableConcept(t)); + if (src.hasEligibility()) + tgt.getEligibilityFirstRep().setCode(VersionConvertor_10_50.convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + tgt.getEligibilityFirstRep().setComment(src.getEligibilityNote()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_50.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(VersionConvertor_10_50.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ImplementationGuide10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ImplementationGuide10_50.java new file mode 100644 index 000000000..a4b8237fa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ImplementationGuide10_50.java @@ -0,0 +1,261 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; + +import java.util.List; + +public class ImplementationGuide10_50 { + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) { + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + } + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasType()) { + tgt.setType(src.getType()); + } + tgt.setProfile(VersionConvertor_10_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) + tgt.setExampleFor(VersionConvertor_10_50.convertCanonicalToReference(src.getExampleCanonicalType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_10_50.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasExampleFor()) + tgt.setExample(VersionConvertor_10_50.convertReferenceToCanonical(src.getExampleFor())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_10_50.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasSource()) { + tgt.setName(convertUriToUrl(src.getSourceElement())); + } + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch(generation) { + case HTML: + return GuidePageKind.PAGE; + default: + return GuidePageKind.RESOURCE; + } + } + + static public GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch(kind) { + case PAGE: + return GuidePageGeneration.HTML; + default: + return GuidePageGeneration.GENERATED; + } + } + + public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + VersionConvertor_10_50.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + if (id != null) + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (id.equals(t.getId())) + return t; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/List10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/List10_50.java new file mode 100644 index 000000000..031c6fe2b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/List10_50.java @@ -0,0 +1,150 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class List10_50 { + + public static org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_50.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(VersionConvertor_10_50.convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.r5.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_50.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_50.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(VersionConvertor_10_50.convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(VersionConvertor_10_50.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; + default: + return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + } + } + + public static void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_50.convertExtension(e)); + } + } + + public static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_10_50.convertExtension(e)); + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Location10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Location10_50.java new file mode 100644 index 000000000..75e7ef65b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Location10_50.java @@ -0,0 +1,125 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Location10_50 { + + public static org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_50.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.addType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + tgt.setPhysicalType(VersionConvertor_10_50.convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.r5.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.r5.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationDispense10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationDispense10_50.java new file mode 100644 index 000000000..a2640c244 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationDispense10_50.java @@ -0,0 +1,177 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Dosage; +import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent; + +public class MedicationDispense10_50 { + + public static org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); + tgt.setMedication(VersionConvertor_10_50.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_50.convertReference(t)); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_50.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_50.convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); + tgt.setMedication(VersionConvertor_10_50.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_10_50.convertReference(t)); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(VersionConvertor_10_50.convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_50.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_50.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_50.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_50.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(VersionConvertor_10_50.convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(VersionConvertor_10_50.convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(VersionConvertor_10_50.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_50.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_50.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_50.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_50.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(VersionConvertor_10_50.convertType(src.getDoseAndRate().get(0).getDose())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_50.convertRatio(src.getMaxDosePerPeriod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(VersionConvertor_10_50.convertType(src.getDoseAndRate().get(0).getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(); + VersionConvertor_10_50.copyElement(src, tgt); + switch(src.getValue()) { + case COMPLETED: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ENTEREDINERROR); + break; + case INPROGRESS: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.INPROGRESS); + break; + case NULL: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.NULL); + break; + case ONHOLD: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ONHOLD); + break; + case STOPPED: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED); + break; + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration(new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatusEnumFactory()); + VersionConvertor_10_50.copyElement(src, tgt); + switch(src.getValue()) { + case COMPLETED: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); + break; + case INPROGRESS: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); + break; + case NULL: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL); + break; + case ONHOLD: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); + break; + case STOPPED: + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED); + break; + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_50.convertCodeableConcept(t)); + if (src.hasResponsibleParty()) + tgt.addResponsibleParty(VersionConvertor_10_50.convertReference(src.getResponsibleParty())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_10_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) tgt.setResponsibleParty(VersionConvertor_10_50.convertReference(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java new file mode 100644 index 000000000..1adf4dd1b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent; + +public class MedicationStatement10_50 { + + public static org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationUsage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_50.convertType(src.getMedication())); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_50.convertReference(src.getInformationSource())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) tgt.addSupportingInformation(VersionConvertor_10_50.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationUsage convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationUsage tgt = new org.hl7.fhir.r5.model.MedicationUsage(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(VersionConvertor_10_50.convertType(src.getMedication())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setInformationSource(VersionConvertor_10_50.convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) tgt.addDerivedFrom(VersionConvertor_10_50.convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_50.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_50.convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(VersionConvertor_10_50.convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(VersionConvertor_10_50.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + if (src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasRate()) + dr.setRate(VersionConvertor_10_50.convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(VersionConvertor_10_50.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(VersionConvertor_10_50.convertTiming(src.getTiming())); + tgt.setAsNeeded(VersionConvertor_10_50.convertType(src.getAsNeeded())); + tgt.setSite(VersionConvertor_10_50.convertType(src.getSite())); + tgt.setRoute(VersionConvertor_10_50.convertCodeableConcept(src.getRoute())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(VersionConvertor_10_50.convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(VersionConvertor_10_50.convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED; + default: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: + return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MessageHeader10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MessageHeader10_50.java new file mode 100644 index 000000000..db5b3d554 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MessageHeader10_50.java @@ -0,0 +1,142 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageHeader10_50 { + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_10_50.convertCoding(src.getEventCoding())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_50.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setResponsible(VersionConvertor_10_50.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_50.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) tgt.addData(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setEvent(VersionConvertor_10_50.convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(VersionConvertor_10_50.convertReference(src.getEnterer())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setResponsible(VersionConvertor_10_50.convertReference(src.getResponsible())); + tgt.setReason(VersionConvertor_10_50.convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) tgt.addFocus(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_50.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(VersionConvertor_10_50.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_50.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(VersionConvertor_10_50.convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/NamingSystem10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/NamingSystem10_50.java new file mode 100644 index 000000000..61fb7cf8d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/NamingSystem10_50.java @@ -0,0 +1,162 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem10_50 { + + public static org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Observation10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Observation10_50.java new file mode 100644 index 000000000..3627d65b4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Observation10_50.java @@ -0,0 +1,174 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Observation10_50 { + + public static org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept c : src.getCategory()) tgt.setCategory(VersionConvertor_10_50.convertCodeableConcept(c)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_50.convertReference(t)); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_50.convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(VersionConvertor_10_50.convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComments(src.getNoteFirstRep().getText()); + tgt.setBodySite(VersionConvertor_10_50.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_50.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_50.convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(src.getCategory())); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setEffective(VersionConvertor_10_50.convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_10_50.convertReference(t)); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_50.convertCodeableConcept(src.getDataAbsentReason())); + tgt.addInterpretation(VersionConvertor_10_50.convertCodeableConcept(src.getInterpretation())); + tgt.addNote().setText(src.getComments()); + tgt.setBodySite(VersionConvertor_10_50.convertCodeableConcept(src.getBodySite())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(VersionConvertor_10_50.convertReference(src.getSpecimen())); + tgt.setDevice(VersionConvertor_10_50.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(VersionConvertor_10_50.convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(VersionConvertor_10_50.convertReference(t.getTarget())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_50.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setDataAbsentReason(VersionConvertor_10_50.convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_50.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_50.convertSimpleQuantity(src.getHigh())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getMeaning())); + tgt.setAge(VersionConvertor_10_50.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLow(VersionConvertor_10_50.convertSimpleQuantity(src.getLow())); + tgt.setHigh(VersionConvertor_10_50.convertSimpleQuantity(src.getHigh())); + tgt.setMeaning(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setAge(VersionConvertor_10_50.convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(VersionConvertor_10_50.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationDefinition10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationDefinition10_50.java new file mode 100644 index 000000000..4c0074326 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationDefinition10_50.java @@ -0,0 +1,225 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.dstu2.model.Reference; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.DataType; +import org.hl7.fhir.r5.model.Enumerations; +import org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes; +import org.hl7.fhir.r5.model.Enumerations.SearchParamType; +import org.hl7.fhir.utilities.Utilities; + +public class OperationDefinition10_50 { + + public static org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_10_50.convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBaseElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_50.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_10_50.convertBindingStrength(src.getStrength())); + DataType t = VersionConvertor_10_50.convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { + tgt.setType(FHIRAllTypes.STRING); + tgt.setSearchType(SearchParamType.fromCode(src.getType())); + } else { + tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); + } + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + } else + tgt.setType(src.getType().toCode()); + for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) tgt.setProfile(new Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationOutcome10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationOutcome10_50.java new file mode 100644 index 000000000..8dd5c7a71 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/OperationOutcome10_50.java @@ -0,0 +1,219 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome10_50 { + + public static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_50.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_10_50.convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Organization10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Organization10_50.java new file mode 100644 index 000000000..dcc4d5706 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Organization10_50.java @@ -0,0 +1,63 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Organization10_50 { + + public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setPartOf(VersionConvertor_10_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_50.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_50.convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setPurpose(VersionConvertor_10_50.convertCodeableConcept(src.getPurpose())); + tgt.setName(VersionConvertor_10_50.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Parameters10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Parameters10_50.java new file mode 100644 index 000000000..70b09893e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Parameters10_50.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters10_50 { + + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + VersionConvertor_10_50.copyResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); + VersionConvertor_10_50.copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_50.convertResource(src.getResource())); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + tgt.setResource(VersionConvertor_10_50.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Patient10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Patient10_50.java new file mode 100644 index 000000000..30fbe0d31 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Patient10_50.java @@ -0,0 +1,190 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Patient10_50 { + + public static org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(VersionConvertor_10_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(VersionConvertor_10_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(VersionConvertor_10_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + VersionConvertor_10_50.copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", VersionConvertor_10_50.convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", VersionConvertor_10_50.convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", VersionConvertor_10_50.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_50.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_50.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setName(VersionConvertor_10_50.convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setAddress(VersionConvertor_10_50.convertAddress(src.getAddress())); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setOrganization(VersionConvertor_10_50.convertReference(src.getOrganization())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACE: + return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; + case REFER: + return org.hl7.fhir.r5.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.r5.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REPLACES: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REFER: + return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_50.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_50.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_50.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_50.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_50.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) tgt.addGeneralPractitioner(VersionConvertor_10_50.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(VersionConvertor_10_50.convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setMaritalStatus(VersionConvertor_10_50.convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(VersionConvertor_10_50.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_50.convertAttachment(t)); + for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) tgt.addCareProvider(VersionConvertor_10_50.convertReference(t)); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_50.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLanguage(VersionConvertor_10_50.convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_50.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOther(VersionConvertor_10_50.convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Person10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Person10_50.java new file mode 100644 index 000000000..b64a70c46 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Person10_50.java @@ -0,0 +1,97 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Person10_50 { + + public static org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_50.convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_50.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_10_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setPhoto(VersionConvertor_10_50.convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(VersionConvertor_10_50.convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setTarget(VersionConvertor_10_50.convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Practitioner10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Practitioner10_50.java new file mode 100644 index 000000000..cdd09417c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Practitioner10_50.java @@ -0,0 +1,68 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Practitioner10_50 { + + public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + if (src.hasName()) + tgt.addName(VersionConvertor_10_50.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_50.convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.setName(VersionConvertor_10_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_10_50.convertAddress(t)); + tgt.setGender(VersionConvertor_10_50.convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_10_50.convertAttachment(t)); + for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_10_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_50.convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setPeriod(VersionConvertor_10_50.convertPeriod(src.getPeriod())); + tgt.setIssuer(VersionConvertor_10_50.convertReference(src.getIssuer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java new file mode 100644 index 000000000..e64dba5ab --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java @@ -0,0 +1,242 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.ContactDetail; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; + +public class Questionnaire10_50 { + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); + tgt.setTitle(root.getTitle()); + for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) tgt.addCode(VersionConvertor_10_50.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + tgt.addItem(convertQuestionnaireGroupComponent(root)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t1)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); + root.setTitle(src.getTitle()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { + root.addConcept(VersionConvertor_10_50.convertCoding(t)); + } + for (CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) + root.addGroup(convertQuestionnaireGroupComponent(t)); + else + root.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_50.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + else + tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_50.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; + case STRING: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; + case TEXT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; + case URL: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; + case CHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_50.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(VersionConvertor_10_50.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) if (t.hasValueCoding()) + try { + tgt.addOption(VersionConvertor_10_50.convertCoding(t.getValueCoding())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_50.convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setAnswerValueSetElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) tgt.addAnswerOption().setValue(VersionConvertor_10_50.convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BOOLEAN: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/QuestionnaireResponse10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/QuestionnaireResponse10_50.java new file mode 100644 index 000000000..67d292177 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/QuestionnaireResponse10_50.java @@ -0,0 +1,142 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse10_50 { + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_10_50.convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + if (src.getItem().size() != 1) + throw new FHIRException("multiple root items not supported"); + tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setAuthor(VersionConvertor_10_50.convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_10_50.convertReference(src.getSource())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + if (src.hasGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/RiskAssessment10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/RiskAssessment10_50.java new file mode 100644 index 000000000..2096facbe --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/RiskAssessment10_50.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class RiskAssessment10_50 { + + public static org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_50.convertReference(src.getCondition())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_50.convertReference(src.getPerformer())); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setSubject(VersionConvertor_10_50.convertReference(src.getSubject())); + tgt.setCondition(VersionConvertor_10_50.convertReference(src.getCondition())); + tgt.setEncounter(VersionConvertor_10_50.convertReference(src.getEncounter())); + tgt.setPerformer(VersionConvertor_10_50.convertReference(src.getPerformer())); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setMethod(VersionConvertor_10_50.convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_50.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_50.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_50.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOutcome(VersionConvertor_10_50.convertCodeableConcept(src.getOutcome())); + tgt.setProbability(VersionConvertor_10_50.convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(VersionConvertor_10_50.convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Schedule10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Schedule10_50.java new file mode 100644 index 000000000..dc5b3f74b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Schedule10_50.java @@ -0,0 +1,33 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Schedule10_50 { + + public static org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.addType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setActor(VersionConvertor_10_50.convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(VersionConvertor_10_50.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addServiceType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.addActor(VersionConvertor_10_50.convertReference(src.getActor())); + tgt.setPlanningHorizon(VersionConvertor_10_50.convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SearchParameter10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SearchParameter10_50.java new file mode 100644 index 000000000..e5278ef32 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SearchParameter10_50.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.dstu2.utils.ToolingExtensions; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; + +public class SearchParameter10_50 { + + public static org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_10_50.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_10_50.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Slot10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Slot10_50.java new file mode 100644 index 000000000..b00d7f45a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Slot10_50.java @@ -0,0 +1,38 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Slot10_50 { + + public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setSchedule(VersionConvertor_10_50.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setSchedule(VersionConvertor_10_50.convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/StructureDefinition10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/StructureDefinition10_50.java new file mode 100644 index 000000000..dd8a37169 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/StructureDefinition10_50.java @@ -0,0 +1,294 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.utilities.Utilities; + +import java.util.ArrayList; +import java.util.List; + +public class StructureDefinition10_50 { + + static public org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource102(tn)) { + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_10_50.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_10_50.convertCoding(t)); + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getIdElement().getIdPart())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getIdElement().getIdPart())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/" + tgt.getType()); + tgt.setType(tgt.getIdElement().getIdPart()); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_50.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_50.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "integer64", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(VersionConvertor_10_50.convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_50.convertElementDefinition(t)); + return tgt; + } + + static public boolean isResource102(String tn) { + return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", "MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance", "SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription"); + } + + static public String tail(String base) { + return base.substring(base.lastIndexOf("/") + 1); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java new file mode 100644 index 000000000..3063a101b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java @@ -0,0 +1,76 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Substance10_50 { + + public static org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_50.convertRatio(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setQuantity(VersionConvertor_10_50.convertRatio(src.getQuantity())); + tgt.setSubstance(VersionConvertor_10_50.convertReference(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyDelivery10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyDelivery10_50.java new file mode 100644 index 000000000..60d2e9be1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyDelivery10_50.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyDelivery10_50 { + + public static org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_50.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(VersionConvertor_10_50.convertReference(src.getPatient())); + tgt.setType(VersionConvertor_10_50.convertCodeableConcept(src.getType())); + tgt.setSupplier(VersionConvertor_10_50.convertReference(src.getSupplier())); + tgt.setDestination(VersionConvertor_10_50.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_10_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyRequest10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyRequest10_50.java new file mode 100644 index 000000000..fb48a3669 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/SupplyRequest10_50.java @@ -0,0 +1,22 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyRequest10_50 { + + public static org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r5.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); + return tgt; + } + + public static org.hl7.fhir.r5.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SupplyRequest tgt = new org.hl7.fhir.r5.model.SupplyRequest(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/TestScript10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/TestScript10_50.java new file mode 100644 index 000000000..91d4bf63a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/TestScript10_50.java @@ -0,0 +1,614 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.TestScript; + +public class TestScript10_50 { + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return "application/fhir+xml"; + case JSON: + return "application/fhir+json"; + default: + return null; + } + } + + static public org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) + return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; + if (src.contains("json")) + return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; + return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(TestScript.FHIRDefinedType.fromCode(src.getResource())); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource().toCode()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCoding(src.getType())); + tgt.setResource(src.getResource().toCode()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setType(VersionConvertor_10_50.convertCoding(src.getType())); + tgt.setResource(TestScript.FHIRDefinedType.fromCode(src.getResource())); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasIdentifier()) { + tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifierFirstRep())); + } + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_50.convertReference(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_50.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(VersionConvertor_10_50.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r5.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setConformance(VersionConvertor_10_50.convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setCapabilitiesElement(VersionConvertor_10_50.convertReferenceToCanonical(src.getConformance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java new file mode 100644 index 000000000..30dc2526d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java @@ -0,0 +1,412 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor50; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; + +import java.util.List; + +public class ValueSet10_50 { + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_10_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; + default: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier i : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_10_50.convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + org.hl7.fhir.r5.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null && advisor != null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor50 advisor) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + VersionConvertor_10_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.r5.model.CodeSystem tgtcs = new org.hl7.fhir.r5.model.CodeSystem(); + VersionConvertor_10_50.copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName() + " Code System"); + tgtcs.setStatus(VersionConvertor_10_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_10_50.isJurisdiction(t)) + tgtcs.addJurisdiction(VersionConvertor_10_50.convertCodeableConcept(t)); + else + tgtcs.addUseContext(VersionConvertor_10_50.convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + return convertValueSet(src, null); + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_10_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_10_50.convertType(src.getValue())); + return tgt; + } + + static public void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_50.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS); + } + + static public void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(VersionConvertor_10_50.convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Bundle14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Bundle14_30.java new file mode 100644 index 000000000..7152203a9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Bundle14_30.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle14_30 { + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + VersionConvertor_14_30.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_30.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); + VersionConvertor_14_30.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_30.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_30.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_30.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CodeSystem14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CodeSystem14_30.java new file mode 100644 index 000000000..23f9332e7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CodeSystem14_30.java @@ -0,0 +1,332 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator; +import org.hl7.fhir.dstu3.model.Enumeration; +import org.hl7.fhir.exceptions.FHIRException; + +public class CodeSystem14_30 { + + public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; + case FRAGMENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLAR: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) try { + tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (Enumeration t : src.getOperator()) tgt.addOperator(t.getValue().toCode()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (ConceptDefinitionPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CompartmentDefinition14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CompartmentDefinition14_30.java new file mode 100644 index 000000000..855f2dccf --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/CompartmentDefinition14_30.java @@ -0,0 +1,141 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class CompartmentDefinition14_30 { + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java new file mode 100644 index 000000000..02a432904 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.dstu3.model.ConceptMap; +import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap14_30 { + + public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_14_30.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_14_30.convertType(src.getTarget())); + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setSource(VersionConvertor_14_30.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_14_30.convertType(src.getTarget())); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_14_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (g.hasSource()) + tgt.setSystem(g.getSource()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new VersionConvertor_14_30.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (g.hasTarget()) + tgt.setSystem(g.getTarget()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComments(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComments()) + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Conformance14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Conformance14_30.java new file mode 100644 index 000000000..0d4ca5ddd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Conformance14_30.java @@ -0,0 +1,802 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Conformance14_30 { + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_14_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_14_30.convertReference(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_30.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_30.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_14_30.convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(VersionConvertor_14_30.convertReference(src.getRequest())); + tgt.setResponse(VersionConvertor_14_30.convertReference(src.getResponse())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(VersionConvertor_14_30.convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(VersionConvertor_14_30.convertReference(src.getRequest())); + tgt.setResponse(VersionConvertor_14_30.convertReference(src.getResponse())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_14_30.convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_14_30.convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_30.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_30.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NO: + return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; + case EXTENSIONS: + return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; + case ELEMENTS: + return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; + case BOTH: + return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NO: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; + case EXTENSIONS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + case ELEMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + case BOTH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/DataElement14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/DataElement14_30.java new file mode 100644 index 000000000..bc25c1430 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/DataElement14_30.java @@ -0,0 +1,164 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class DataElement14_30 { + + public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPARABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; + default: + return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPARABLE: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; + default: + return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ImplementationGuide14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ImplementationGuide14_30.java new file mode 100644 index 000000000..189f7bd21 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ImplementationGuide14_30.java @@ -0,0 +1,306 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ImplementationGuide14_30 { + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REFERENCE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PAGE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PAGE: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: + return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setExample(src.getExample()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAcronym()) + tgt.setAcronym(src.getAcronym()); + tgt.setSource(VersionConvertor_14_30.convertType(src.getSource())); + if (src.hasExampleFor()) + tgt.setExampleFor(VersionConvertor_14_30.convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setExample(src.getExample()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAcronym()) + tgt.setAcronym(src.getAcronym()); + tgt.setSource(VersionConvertor_14_30.convertType(src.getSource())); + if (src.hasExampleFor()) + tgt.setExampleFor(VersionConvertor_14_30.convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setTitle(src.getName()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); + if (src.hasFormat()) + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setName(src.getTitle()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); + if (src.hasFormat()) + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/NamingSystem14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/NamingSystem14_30.java new file mode 100644 index 000000000..7f971c9cc --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/NamingSystem14_30.java @@ -0,0 +1,174 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem14_30 { + + public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_30.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(VersionConvertor_14_30.convertReference(src.getReplacedBy())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_30.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(VersionConvertor_14_30.convertReference(src.getReplacedBy())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_30.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_30.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationDefinition14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationDefinition14_30.java new file mode 100644 index 000000000..cbf516970 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationDefinition14_30.java @@ -0,0 +1,228 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +public class OperationDefinition14_30 { + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(VersionConvertor_14_30.convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(VersionConvertor_14_30.convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_30.convertBindingStrength(src.getStrength())); + tgt.setValueSet(VersionConvertor_14_30.convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_30.convertBindingStrength(src.getStrength())); + tgt.setValueSet(VersionConvertor_14_30.convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(VersionConvertor_14_30.convertSearchParamType(src.getSearchType())); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (Utilities.existsInList(src.getType(), "token", "reference", "composite", "number", "date", "quantity", "uri")) { + tgt.setType("string"); + tgt.setSearchType(SearchParamType.fromCode(src.getType())); + } else { + tgt.setType(src.getType()); + } + tgt.setSearchType(VersionConvertor_14_30.convertSearchParamType(src.getSearchType())); + tgt.setProfile(VersionConvertor_14_30.convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationOutcome14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationOutcome14_30.java new file mode 100644 index 000000000..41939a74c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/OperationOutcome14_30.java @@ -0,0 +1,223 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome14_30 { + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_30.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_30.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Parameters14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Parameters14_30.java new file mode 100644 index 000000000..8edf96674 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Parameters14_30.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters14_30 { + + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + VersionConvertor_14_30.copyResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); + VersionConvertor_14_30.copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_30.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_30.convertResource(src.getResource())); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Questionnaire14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Questionnaire14_30.java new file mode 100644 index 000000000..137512d8e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/Questionnaire14_30.java @@ -0,0 +1,290 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.UsageContext; +import org.hl7.fhir.exceptions.FHIRException; + +public class Questionnaire14_30 { + + public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t1)); + for (UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_30.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_30.convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_30.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(VersionConvertor_14_30.convertReference(src.getOptions())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + tgt.setInitial(VersionConvertor_14_30.convertType(src.getInitial())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_30.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(VersionConvertor_14_30.convertReference(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + tgt.setInitial(VersionConvertor_14_30.convertType(src.getInitial())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasHasAnswer()) + tgt.setAnswered(src.getHasAnswer()); + tgt.setAnswer(VersionConvertor_14_30.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasAnswered()) + tgt.setHasAnswer(src.getAnswered()); + tgt.setAnswer(VersionConvertor_14_30.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/QuestionnaireResponse14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/QuestionnaireResponse14_30.java new file mode 100644 index 000000000..b2b7852f0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/QuestionnaireResponse14_30.java @@ -0,0 +1,123 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse14_30 { + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_14_30.convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_30.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_14_30.convertReference(src.getContext())); + tgt.setAuthor(VersionConvertor_14_30.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_30.convertReference(src.getSource())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_14_30.convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_30.convertReference(src.getSubject())); + tgt.setContext(VersionConvertor_14_30.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_14_30.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_30.convertReference(src.getSource())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setSubject(VersionConvertor_14_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setSubject(VersionConvertor_14_30.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/SearchParameter14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/SearchParameter14_30.java new file mode 100644 index 000000000..8fc1175a0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/SearchParameter14_30.java @@ -0,0 +1,134 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter14_30 { + + public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_14_30.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_14_30.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/StructureDefinition14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/StructureDefinition14_30.java new file mode 100644 index 000000000..17d18ec4a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/StructureDefinition14_30.java @@ -0,0 +1,290 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.exceptions.FHIRException; + +public class StructureDefinition14_30 { + + static public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_14_30.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setBaseType(src.getType()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasDisplay()) + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_14_30.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); + if (src.getDerivation() == TypeDerivationRule.CONSTRAINT) + tgt.setType(src.getBaseType()); + else + tgt.setType(src.getId()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) { + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.getSnapshot().getElementFirstRep().getType().clear(); + } + if (src.hasDifferential()) { + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + tgt.getDifferential().getElementFirstRep().getType().clear(); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_30.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/TestScript14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/TestScript14_30.java new file mode 100644 index 000000000..af8dd6417 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/TestScript14_30.java @@ -0,0 +1,961 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestScript14_30 { + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESPONSE: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.REQUEST; + default: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OKAY: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: + return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2016may.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + case JSON: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + default: + return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case XML: + return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.XML; + case JSON: + return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.JSON; + default: + return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); + tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); + tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent t : src.getParam()) tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent t : src.getParam()) tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent t : src.getRule()) tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent t : src.getRule()) tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent t : src.getParam()) tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent t : src.getParam()) tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setType(VersionConvertor_14_30.convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2016may.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_14_30.convertReference(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent t : src.getRule()) tgt.addRule(convertTestScriptRuleComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) tgt.addRuleset(convertTestScriptRulesetComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript tgt = new org.hl7.fhir.dstu2016may.model.TestScript(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_14_30.convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent t : src.getRule()) tgt.addRule(convertTestScriptRuleComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) tgt.addRuleset(convertTestScriptRulesetComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(VersionConvertor_14_30.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(VersionConvertor_14_30.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setCapabilities(VersionConvertor_14_30.convertReference(src.getConformance())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + tgt.setConformance(VersionConvertor_14_30.convertReference(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(VersionConvertor_14_30.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(VersionConvertor_14_30.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent t : src.getParam()) tgt.addParam(convertTestScriptRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + for (org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent t : src.getParam()) tgt.addParam(convertTestScriptRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent t : src.getRule()) tgt.addRule(convertTestScriptRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setResource(VersionConvertor_14_30.convertReference(src.getResource())); + for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent t : src.getRule()) tgt.addRule(convertTestScriptRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent t : src.getParam()) tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent t : src.getParam()) tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ValueSet14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ValueSet14_30.java new file mode 100644 index 000000000..69403a105 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ValueSet14_30.java @@ -0,0 +1,364 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.exceptions.FHIRException; + +public class ValueSet14_30 { + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_14_30.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.getCompose().hasLockedDate()) + tgt.setLockedDate(src.getCompose().getLockedDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_30.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.setExtensible(src.getExtensible()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + VersionConvertor_14_30.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_14_30.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_30.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_30.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_30.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_30.convertCodeableConceptToUsageContext(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.setExtensible(src.getExtensible()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasLockedDate()) + tgt.getCompose().setLockedDate(src.getLockedDate()); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_30.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_30.convertType(src.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Bundle14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Bundle14_40.java new file mode 100644 index 000000000..a521bce69 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Bundle14_40.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle14_40 { + + public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); + VersionConvertor_14_40.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); + VersionConvertor_14_40.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_40.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_40.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CodeSystem14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CodeSystem14_40.java new file mode 100644 index 000000000..6b8d5c9b6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CodeSystem14_40.java @@ -0,0 +1,334 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CodeSystem; +import org.hl7.fhir.r4.model.CodeSystem.FilterOperator; +import org.hl7.fhir.r4.model.Enumeration; + +public class CodeSystem14_40 { + + public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; + case FRAGMENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLAR: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) try { + tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (Enumeration t : src.getOperator()) tgt.addOperator(t.getValue().toCode()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (ConceptDefinitionPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.r4.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r4.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CompartmentDefinition14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CompartmentDefinition14_40.java new file mode 100644 index 000000000..08d89ae5d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/CompartmentDefinition14_40.java @@ -0,0 +1,141 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CompartmentDefinition14_40 { + + public static org.hl7.fhir.r4.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition tgt = new org.hl7.fhir.r4.model.CompartmentDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r4.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java new file mode 100644 index 000000000..ad73dac5e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java @@ -0,0 +1,266 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CanonicalType; +import org.hl7.fhir.r4.model.ConceptMap; +import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap14_40 { + + public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r4.model.Type tt = VersionConvertor_14_40.convertType(src.getSource()); + tgt.setSource(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt); + tt = VersionConvertor_14_40.convertType(src.getTarget()); + tgt.setTarget(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_14_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.getSource() instanceof CanonicalType) + tgt.setSource(VersionConvertor_14_40.convertCanonicalToReference((CanonicalType) src.getSource())); + else + tgt.setSource(VersionConvertor_14_40.convertType(src.getSource())); + if (src.getTarget() instanceof CanonicalType) + tgt.setTarget(VersionConvertor_14_40.convertCanonicalToReference((CanonicalType) src.getTarget())); + else + tgt.setTarget(VersionConvertor_14_40.convertType(src.getTarget())); + tgt.setSource(VersionConvertor_14_40.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_14_40.convertType(src.getTarget())); + for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new VersionConvertor_14_40.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (g.hasSource()) + tgt.setSystem(g.getSource()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComments()) + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (g.hasTarget()) + tgt.setSystem(g.getTarget()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Conformance14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Conformance14_40.java new file mode 100644 index 000000000..25b74f61c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Conformance14_40.java @@ -0,0 +1,699 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent; + +public class Conformance14_40 { + + static public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); + VersionConvertor_14_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + 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())); + for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_14_40.convertCanonicalToReference(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + 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())); + 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)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_14_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_14_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + event.setCode(VersionConvertor_14_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType()); + VersionConvertor_14_40.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_14_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_14_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r4.model.Extension("code", VersionConvertor_14_40.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); + org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); + VersionConvertor_14_40.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r4.model.Extension("request", VersionConvertor_14_40.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("response", VersionConvertor_14_40.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_40.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_40.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_14_40.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_40.convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_40.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_40.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/DataElement14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/DataElement14_40.java new file mode 100644 index 000000000..fa5c58774 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/DataElement14_40.java @@ -0,0 +1,81 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; + +public class DataElement14_40 { + + public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.getSnapshot().addElement(VersionConvertor_14_40.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ImplementationGuide14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ImplementationGuide14_40.java new file mode 100644 index 000000000..8a443444b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ImplementationGuide14_40.java @@ -0,0 +1,287 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CanonicalType; +import org.hl7.fhir.r4.model.Enumeration; +import org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration; +import org.hl7.fhir.r4.model.Type; + +import java.util.List; + +public class ImplementationGuide14_40 { + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setUri(src.getUri()); + if (org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { + tgt.setPackageId(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); + } + if (org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { + tgt.setVersion(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(VersionConvertor_14_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(VersionConvertor_14_40.convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_14_40.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasExampleFor()) { + Type t = VersionConvertor_14_40.convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r4.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_14_40.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch(generation) { + case HTML: + return GuidePageKind.PAGE; + default: + return GuidePageKind.RESOURCE; + } + } + + static public GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch(kind) { + case PAGE: + return GuidePageGeneration.HTML; + default: + return GuidePageGeneration.GENERATED; + } + } + + public static org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + VersionConvertor_14_40.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (t.getId().equals(id)) + return t; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/NamingSystem14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/NamingSystem14_40.java new file mode 100644 index 000000000..f4e015a3e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/NamingSystem14_40.java @@ -0,0 +1,172 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem14_40 { + + public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_40.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_40.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; + } + } + + static public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationDefinition14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationDefinition14_40.java new file mode 100644 index 000000000..540cc16cd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationDefinition14_40.java @@ -0,0 +1,237 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Type; + +public class OperationDefinition14_40 { + + public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBaseElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(VersionConvertor_14_40.convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_40.convertBindingStrength(src.getStrength())); + Type t = VersionConvertor_14_40.convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r4.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_40.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(VersionConvertor_14_40.convertSearchParamType(src.getSearchType())); + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(VersionConvertor_14_40.convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r4.model.UriType t : src.getTargetProfile()) tgt.setProfile(new org.hl7.fhir.dstu2016may.model.Reference(t.getValue())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationOutcome14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationOutcome14_40.java new file mode 100644 index 000000000..510edcbf0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/OperationOutcome14_40.java @@ -0,0 +1,223 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome14_40 { + + static public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_40.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getExpression()) tgt.addExpression(VersionConvertor_14_40.convertTo2016MayExpression(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_40.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) tgt.addExpression(VersionConvertor_14_40.convertToR4Expression(t.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Parameters14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Parameters14_40.java new file mode 100644 index 000000000..f9233b5ba --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Parameters14_40.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters14_40 { + + public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); + VersionConvertor_14_40.copyResource(src, tgt); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + VersionConvertor_14_40.copyResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_40.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_40.convertResource(src.getResource())); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Questionnaire14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Questionnaire14_40.java new file mode 100644 index 000000000..76f3d7fae --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/Questionnaire14_40.java @@ -0,0 +1,295 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.ContactDetail; +import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator; +import org.hl7.fhir.r4.model.UsageContext; + +public class Questionnaire14_40 { + + public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_40.convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t1)); + for (UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_40.convertCoding(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_40.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setAnswerValueSetElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + tgt.addInitial().setValue(VersionConvertor_14_40.convertType(src.getInitial())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_40.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(VersionConvertor_14_40.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(VersionConvertor_14_40.convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasAnswered()) { + tgt.setOperator(QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(VersionConvertor_14_40.convertType(src.getAnsweredElement())); + } + tgt.setAnswer(VersionConvertor_14_40.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) + tgt.setAnswered(src.getAnswerBooleanType().getValue()); + else + tgt.setAnswer(VersionConvertor_14_40.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/QuestionnaireResponse14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/QuestionnaireResponse14_40.java new file mode 100644 index 000000000..70f49891c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/QuestionnaireResponse14_40.java @@ -0,0 +1,121 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse14_40 { + + public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(VersionConvertor_14_40.convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_14_40.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_14_40.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_40.convertReference(src.getSource())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_14_40.convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_40.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_14_40.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_14_40.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_40.convertReference(src.getSource())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/SearchParameter14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/SearchParameter14_40.java new file mode 100644 index 000000000..b3df0a4c7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/SearchParameter14_40.java @@ -0,0 +1,134 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter14_40 { + + public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_14_40.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(VersionConvertor_14_40.convertToR4Expression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_14_40.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(VersionConvertor_14_40.convertTo2016MayExpression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureDefinition14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureDefinition14_40.java new file mode 100644 index 000000000..8dfd797b9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureDefinition14_40.java @@ -0,0 +1,317 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.ElementDefinition; +import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.utilities.Utilities; + +public class StructureDefinition14_40 { + + static public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource140(tn)) { + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_14_40.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasType() && src.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setBaseType(src.getType()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasDisplay()) + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_14_40.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), src.getName())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setType(src.getBaseType()); + else + tgt.setType(src.getId()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) { + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.getSnapshot().getElementFirstRep().getType().clear(); + } + if (src.hasDifferential()) { + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + tgt.getDifferential().getElementFirstRep().getType().clear(); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_40.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_40.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src, String name) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + if (name.substring(0, 1).toLowerCase().equals(name.substring(0, 1))) + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_40.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_40.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public boolean isResource140(String tn) { + return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription"); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureMap14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureMap14_40.java new file mode 100644 index 000000000..d87fb1fd6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/StructureMap14_40.java @@ -0,0 +1,546 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.dstu2016may.model.StructureMap; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Enumeration; + +public class StructureMap14_40 { + + public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r4.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap tgt = new org.hl7.fhir.r4.model.StructureMap(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact()) tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapContextType convertStructureMapContextType(StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r4.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (!src.getTypeMode().equals(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE)) + throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + tgt.setTypeMode(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StringType t : src.getVariable()) tgt.addVariable(t.asStringValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) tgt.addVariable(t.asStringValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setMin(src.getRequired() ? 1 : 0); + if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE)) + tgt.setType(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setContextType(StructureMapContextType.TYPE); + tgt.setContext(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (Enumeration t : src.getListMode()) tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getListMode()) VersionConvertor_14_40.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.FIRST; + case LAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.LAST; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapSourceListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCED: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCED: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.TARGET; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.FIRST; + case LAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.LAST; + case SHARE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.SHARE; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapTargetListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + case SHARE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r4.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPEND: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND; + case CAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST; + case COPY: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY; + case CREATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL; + } + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapTransform convertStructureMapTransform(StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPEND: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.APPEND; + case CAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CAST; + case COPY: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.COPY; + case CREATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.UUID; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ValueSet14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ValueSet14_40.java new file mode 100644 index 000000000..5ebe9dc74 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ValueSet14_40.java @@ -0,0 +1,365 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.BooleanType; + +public class ValueSet14_40 { + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_40.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_14_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_40.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_40.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConceptToUsageContext(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasLockedDate()) + tgt.getCompose().setLockedDate(src.getLockedDate()); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); + VersionConvertor_14_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_14_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_40.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.getCompose().hasLockedDate()) + tgt.setLockedDate(src.getCompose().getLockedDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_40.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_40.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_40.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_40.convertType(src.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Bundle14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Bundle14_50.java new file mode 100644 index 000000000..3996863c8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Bundle14_50.java @@ -0,0 +1,291 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle14_50 { + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + VersionConvertor_14_50.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); + VersionConvertor_14_50.copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(VersionConvertor_14_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_50.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(VersionConvertor_14_50.convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CodeSystem14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CodeSystem14_50.java new file mode 100644 index 000000000..f3e1be9b4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CodeSystem14_50.java @@ -0,0 +1,334 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Enumerations; +import org.hl7.fhir.r5.model.Enumerations.FilterOperator; + +public class CodeSystem14_50 { + + public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; + case FRAGMENT: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLAR: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (Enumeration t : src.getOperator()) tgt.addOperator(t.getValue().toCode()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) try { + tgt.addOperator(Enumerations.FilterOperator.fromCode(t.getValue())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (ConceptDefinitionPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CompartmentDefinition14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CompartmentDefinition14_50.java new file mode 100644 index 000000000..147135ba1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/CompartmentDefinition14_50.java @@ -0,0 +1,143 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class CompartmentDefinition14_50 { + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasCode()) { + tgt.setCode(src.getCode()); + } + for (org.hl7.fhir.r5.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; + default: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java new file mode 100644 index 000000000..43f864bf7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java @@ -0,0 +1,266 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.ConceptMap; +import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; + +import java.util.ArrayList; +import java.util.List; + +public class ConceptMap14_50 { + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r5.model.DataType tt = VersionConvertor_14_50.convertType(src.getSource()); + tgt.setSource(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); + tt = VersionConvertor_14_50.convertType(src.getTarget()); + tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (VersionConvertor_14_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) { + tgt.setIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifierFirstRep())); + } + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.getSource() instanceof CanonicalType) + tgt.setSource(VersionConvertor_14_50.convertCanonicalToReference((CanonicalType) src.getSource())); + else + tgt.setSource(VersionConvertor_14_50.convertType(src.getSource())); + if (src.getTarget() instanceof CanonicalType) + tgt.setTarget(VersionConvertor_14_50.convertCanonicalToReference((CanonicalType) src.getTarget())); + else + tgt.setTarget(VersionConvertor_14_50.convertType(src.getTarget())); + tgt.setSource(VersionConvertor_14_50.convertType(src.getSource())); + tgt.setTarget(VersionConvertor_14_50.convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case BROADER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; + case NARROWER: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; + case NOTRELATEDTO: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUIVALENT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case WIDER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case SUBSUMES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case NARROWER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case INEXACT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; + case UNMATCHED: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + case DISJOINT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; + default: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (t.getEquivalence() == org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { + tgt.setNoMap(true); + } else { + tgt.addTarget(convertTargetElementComponent(t)); + } + res.add(new VersionConvertor_14_50.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (g.hasSource()) + tgt.setSystem(g.getSource()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasNoMap() && src.getNoMap() == true) { + tgt.addTarget(new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); + } else { + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t, g)); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (g.hasTarget()) + tgt.setSystem(g.getTarget()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); + if (src.hasComment()) + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); + if (src.hasComments()) + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Conformance14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Conformance14_50.java new file mode 100644 index 000000000..2b4f4a4bf --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Conformance14_50.java @@ -0,0 +1,697 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; + +public class Conformance14_50 { + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + 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())); + 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)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); + VersionConvertor_14_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + 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())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_14_50.convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(VersionConvertor_14_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_14_50.convertCoding((org.hl7.fhir.r5.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType()); + VersionConvertor_14_50.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_14_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_14_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r5.model.Extension("code", VersionConvertor_14_50.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); + org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); + VersionConvertor_14_50.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r5.model.Extension("request", VersionConvertor_14_50.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("response", VersionConvertor_14_50.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_50.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setProtocol(VersionConvertor_14_50.convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(VersionConvertor_14_50.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasType()) { + tgt.setType(src.getType()); + } + tgt.setProfile(VersionConvertor_14_50.convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_50.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(VersionConvertor_14_50.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/DataElement14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/DataElement14_50.java new file mode 100644 index 000000000..cc9c08766 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/DataElement14_50.java @@ -0,0 +1,81 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; + +public class DataElement14_50 { + + public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.getSnapshot().addElement(VersionConvertor_14_50.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ImplementationGuide14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ImplementationGuide14_50.java new file mode 100644 index 000000000..4541953eb --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ImplementationGuide14_50.java @@ -0,0 +1,293 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.DataType; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; + +import java.util.List; + +public class ImplementationGuide14_50 { + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setUri(src.getUri()); + if (org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { + tgt.setPackageId(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); + } + if (org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { + tgt.setVersion(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + if (src.hasPackageId()) + tgt.addExtension(new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION, new org.hl7.fhir.dstu2016may.model.IdType(src.getPackageId()))); + if (src.hasVersion()) + tgt.addExtension(new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION, new org.hl7.fhir.dstu2016may.model.StringType(src.getVersion()))); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (tgt.hasType()) { + tgt.setType(src.getType()); + } + tgt.setProfile(VersionConvertor_14_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(VersionConvertor_14_50.convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_14_50.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasExampleFor()) { + DataType t = VersionConvertor_14_50.convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_14_50.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch(generation) { + case HTML: + return GuidePageKind.PAGE; + default: + return GuidePageKind.RESOURCE; + } + } + + static public GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch(kind) { + case PAGE: + return GuidePageGeneration.HTML; + default: + return GuidePageGeneration.GENERATED; + } + } + + public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + VersionConvertor_14_50.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (t.getId().equals(id)) + return t; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/NamingSystem14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/NamingSystem14_50.java new file mode 100644 index 000000000..ddea442c6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/NamingSystem14_50.java @@ -0,0 +1,172 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem14_50 { + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_50.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(VersionConvertor_14_50.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; + } + } + + static public org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(VersionConvertor_14_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationDefinition14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationDefinition14_50.java new file mode 100644 index 000000000..8dee82f2b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationDefinition14_50.java @@ -0,0 +1,240 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.DataType; +import org.hl7.fhir.r5.model.Enumerations; + +public class OperationDefinition14_50 { + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(VersionConvertor_14_50.convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (CodeType t : src.getResource()) tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBaseElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_50.convertBindingStrength(src.getStrength())); + DataType t = VersionConvertor_14_50.convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setStrength(VersionConvertor_14_50.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) { + tgt.setType(src.getType().toCode()); + } + tgt.setSearchType(VersionConvertor_14_50.convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) tgt.setProfile(new org.hl7.fhir.dstu2016may.model.Reference(t.getValue())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); + tgt.setSearchType(VersionConvertor_14_50.convertSearchParamType(src.getSearchType())); + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationOutcome14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationOutcome14_50.java new file mode 100644 index 000000000..d9e82bb8c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/OperationOutcome14_50.java @@ -0,0 +1,223 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome14_50 { + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_50.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) tgt.addExpression(VersionConvertor_14_50.convertTo2016MayExpression(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(VersionConvertor_14_50.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) tgt.addExpression(VersionConvertor_14_50.convertToR4Expression(t.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Parameters14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Parameters14_50.java new file mode 100644 index 000000000..057542b21 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Parameters14_50.java @@ -0,0 +1,49 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters14_50 { + + public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); + VersionConvertor_14_50.copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + VersionConvertor_14_50.copyResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_50.convertResource(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + tgt.setResource(VersionConvertor_14_50.convertResource(src.getResource())); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java new file mode 100644 index 000000000..4b8440d5f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java @@ -0,0 +1,294 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.ContactDetail; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; +import org.hl7.fhir.r5.model.UsageContext; + +public class Questionnaire14_50 { + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_50.convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t1)); + for (UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_50.convertCoding(t)); + for (CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(src)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_14_50.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(VersionConvertor_14_50.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(VersionConvertor_14_50.convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_14_50.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setAnswerValueSetElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + tgt.addInitial().setValue(VersionConvertor_14_50.convertType(src.getInitial())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasAnswered()) { + tgt.setOperator(QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(VersionConvertor_14_50.convertType(src.getAnsweredElement())); + } + tgt.setAnswer(VersionConvertor_14_50.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) + tgt.setAnswered(src.getAnswerBooleanType().getValue()); + else + tgt.setAnswer(VersionConvertor_14_50.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case BOOLEAN: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case BOOLEAN: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: + return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: + return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/QuestionnaireResponse14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/QuestionnaireResponse14_50.java new file mode 100644 index 000000000..49e0cb724 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/QuestionnaireResponse14_50.java @@ -0,0 +1,121 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse14_50 { + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(VersionConvertor_14_50.convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_14_50.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_14_50.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_50.convertReference(src.getSource())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(VersionConvertor_14_50.convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(VersionConvertor_14_50.convertReference(src.getSubject())); + tgt.setEncounter(VersionConvertor_14_50.convertReference(src.getEncounter())); + tgt.setAuthor(VersionConvertor_14_50.convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(VersionConvertor_14_50.convertReference(src.getSource())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/SearchParameter14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/SearchParameter14_50.java new file mode 100644 index 000000000..b72cc0c9f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/SearchParameter14_50.java @@ -0,0 +1,135 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; + +public class SearchParameter14_50 { + + public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (CodeType t : src.getBase()) tgt.setBase(t.asStringValue()); + tgt.setType(VersionConvertor_14_50.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(VersionConvertor_14_50.convertTo2016MayExpression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(VersionConvertor_14_50.convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(VersionConvertor_14_50.convertToR4Expression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; + } + } + + static public org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java new file mode 100644 index 000000000..ec79b04e1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java @@ -0,0 +1,317 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.utilities.Utilities; + +public class StructureDefinition14_50 { + + static public org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource140(tn)) { + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setDisplay(src.getTitle()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addCode(VersionConvertor_14_50.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasType() && src.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setBaseType(src.getType()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasDisplay()) + tgt.setTitle(src.getDisplay()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(VersionConvertor_14_50.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), src.getName())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setType(src.getBaseType()); + else + tgt.setType(src.getId()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) { + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.getSnapshot().getElementFirstRep().getType().clear(); + } + if (src.hasDifferential()) { + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + tgt.getDifferential().getElementFirstRep().getType().clear(); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_50.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_50.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src, String name) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DATATYPE: + if (name.substring(0, 1).toLowerCase().equals(name.substring(0, 1))) + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_50.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_14_50.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public boolean isResource140(String tn) { + return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription"); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java new file mode 100644 index 000000000..8b9487f64 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java @@ -0,0 +1,546 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.dstu2016may.model.StructureMap; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Enumeration; + +public class StructureMap14_50 { + + public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact()) tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + tgt.setTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (!src.getTypeMode().equals(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE)) + throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) tgt.addVariable(t.asStringValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) tgt.addVariable(t.asStringValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setContextType(StructureMapContextType.TYPE); + tgt.setContext(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setMin(src.getRequired() ? 1 : 0); + if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE)) + tgt.setType(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (Enumeration t : src.getListMode()) tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getListMode()) VersionConvertor_14_50.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; + case LAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCED: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCED: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + case SHARE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; + case LAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; + case SHARE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPEND: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; + case CAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; + case COPY: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; + case CREATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPEND: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND; + case CAST: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST; + case COPY: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY; + case CREATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID; + default: + return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ValueSet14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ValueSet14_50.java new file mode 100644 index 000000000..106c4b7d4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ValueSet14_50.java @@ -0,0 +1,365 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.BooleanType; + +public class ValueSet14_50 { + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(VersionConvertor_14_50.convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN; + default: + return org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL; + } + } + + static public org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; + case ISNOTA: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; + default: + return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_14_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) if (VersionConvertor_14_50.isJurisdiction(t)) + tgt.addJurisdiction(VersionConvertor_14_50.convertCodeableConcept(t)); + else + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConceptToUsageContext(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasLockedDate()) + tgt.getCompose().setLockedDate(src.getLockedDate()); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); + VersionConvertor_14_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_14_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(VersionConvertor_14_50.convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.getCompose().hasLockedDate()) + tgt.setLockedDate(src.getCompose().getLockedDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept()) + tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(VersionConvertor_14_50.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue()); + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_50.convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_14_50.copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(VersionConvertor_14_50.convertType(src.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ActivityDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ActivityDefinition30_40.java new file mode 100644 index 000000000..933d43d5b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ActivityDefinition30_40.java @@ -0,0 +1,335 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class ActivityDefinition30_40 { + + public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r4.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) tgt.addLibrary(VersionConvertor_30_40.convertCanonicalToReference(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(VersionConvertor_30_40.convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_40.convertDosage(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransform(VersionConvertor_30_40.convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition tgt = new org.hl7.fhir.r4.model.ActivityDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_40.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(VersionConvertor_30_40.convertReferenceToCanonical(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(VersionConvertor_30_40.convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_40.convertDosage(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransformElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + static public org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPOINTMENT: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case PROCEDUREREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case REFERRALREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case SUPPLYREQUEST: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPOINTMENT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case SERVICEREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST; + case SUPPLYREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AllergyIntolerance30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AllergyIntolerance30_40.java new file mode 100644 index 000000000..d9ed8ac8b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AllergyIntolerance30_40.java @@ -0,0 +1,293 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class AllergyIntolerance30_40 { + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r4.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getCategory()) VersionConvertor_30_40.copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_40.convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_40.convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrenceElement(VersionConvertor_30_40.convertDateTime(src.getLastOccurrenceElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getCategory()) VersionConvertor_30_40.copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + if (src.hasAssertedDate()) + tgt.setRecordedDateElement(VersionConvertor_30_40.convertDateTime(src.getAssertedDateElement())); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_40.convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_40.convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrenceElement(VersionConvertor_30_40.convertDateTime(src.getLastOccurrenceElement())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FOOD: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FOOD: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); + case INACTIVE: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); + case RESOLVED: + new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); + default: + return null; + } + } + + static public org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LOW: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LOW: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } + } + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_40.convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnsetElement(VersionConvertor_30_40.convertDateTime(src.getOnsetElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(VersionConvertor_30_40.convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_40.convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnsetElement(VersionConvertor_30_40.convertDateTime(src.getOnsetElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(VersionConvertor_30_40.convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MILD: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } + } + + static public org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MILD: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ALLERGY: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } + } + + static public org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ALLERGY: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: + return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNCONFIRMED: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); + case CONFIRMED: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); + case REFUTED: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); + case ENTEREDINERROR: + return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Appointment30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Appointment30_40.java new file mode 100644 index 000000000..a840375d4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Appointment30_40.java @@ -0,0 +1,227 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Appointment30_40 { + + public static org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_40.convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_30_40.convertReference(t)); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDateTime(src.getCreatedElement())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) tgt.addRequestedPeriod(VersionConvertor_30_40.convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_40.convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addIndication(VersionConvertor_30_40.convertReference(t)); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_30_40.convertReference(t)); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDateTime(src.getCreatedElement())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.r4.model.Period t : src.getRequestedPeriod()) tgt.addRequestedPeriod(VersionConvertor_30_40.convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r4.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + } + } + + static public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; + } + } + + static public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AppointmentResponse30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AppointmentResponse30_40.java new file mode 100644 index 000000000..38b96541f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AppointmentResponse30_40.java @@ -0,0 +1,85 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class AppointmentResponse30_40 { + + public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_40.convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_40.convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AuditEvent30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AuditEvent30_40.java new file mode 100644 index 000000000..dd38d779f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/AuditEvent30_40.java @@ -0,0 +1,351 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class AuditEvent30_40 { + + public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCoding(src.getType())); + for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_40.convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCoding(src.getType())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_40.convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(VersionConvertor_30_40.convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getWho())); + } + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(VersionConvertor_30_40.convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasReference()) + tgt.setWho(VersionConvertor_30_40.convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getUserId())); + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(VersionConvertor_30_40.convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + static public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(VersionConvertor_30_40.convertReference(src.getReference())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(VersionConvertor_30_40.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getWhat())); + } + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(VersionConvertor_30_40.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + static public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCoding(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Basic30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Basic30_40.java new file mode 100644 index 000000000..1b457dcd3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Basic30_40.java @@ -0,0 +1,41 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Basic30_40 { + + public static org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDate(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDate(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Binary30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Binary30_40.java new file mode 100644 index 000000000..3498e9163 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Binary30_40.java @@ -0,0 +1,35 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Binary30_40 { + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + VersionConvertor_30_40.copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(VersionConvertor_30_40.convertReference(src.getSecurityContext())); + if (src.hasData()) + tgt.setContent(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); + VersionConvertor_30_40.copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(VersionConvertor_30_40.convertReference(src.getSecurityContext())); + if (src.hasContent()) + tgt.setData(src.getContent()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/BodySite30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/BodySite30_40.java new file mode 100644 index 000000000..bba68b6d5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/BodySite30_40.java @@ -0,0 +1,39 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class BodySite30_40 { + + public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r4.model.BodyStructure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) tgt.addImage(VersionConvertor_30_40.convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BodyStructure tgt = new org.hl7.fhir.r4.model.BodyStructure(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) tgt.addImage(VersionConvertor_30_40.convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java new file mode 100644 index 000000000..b4d6e246a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java @@ -0,0 +1,323 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle30_40 { + + public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); + VersionConvertor_30_40.copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_30_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + VersionConvertor_30_40.copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_30_40.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModifiedElement(VersionConvertor_30_40.convertInstant(src.getLastModifiedElement())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModifiedElement(VersionConvertor_30_40.convertInstant(src.getLastModifiedElement())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40.java new file mode 100644 index 000000000..f979d6d1d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40.java @@ -0,0 +1,876 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CapabilityStatement30_40 { + + 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(); + VersionConvertor_30_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + 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())); + 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()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_30_40.convertCanonicalToReference(t)); + for (org.hl7.fhir.r4.model.Extension ext : src.getExtension()) { + if ("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile".equals(ext.getUrl())) { + tgt.addProfile(VersionConvertor_30_40.convertReference((org.hl7.fhir.r4.model.Reference) ext.getValue())); + } + } + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + 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())); + 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.Reference t : src.getProfile()) tgt.addExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertCapabilityStatementRestComponent(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()) tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_30_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + event.setCode(VersionConvertor_30_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType()); + VersionConvertor_30_40.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_30_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_30_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r4.model.Extension("code", VersionConvertor_30_40.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); + org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); + VersionConvertor_30_40.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r4.model.Extension("request", VersionConvertor_30_40.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r4.model.Extension("response", VersionConvertor_30_40.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(VersionConvertor_30_40.convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(VersionConvertor_30_40.convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_40.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_40.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getProfile())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getReferencePolicy()) VersionConvertor_30_40.copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCanonicalToReference(src.getProfileElement())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getReferencePolicy()) VersionConvertor_30_40.copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDateElement(VersionConvertor_30_40.convertDateTime(src.getReleaseDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDateElement(VersionConvertor_30_40.convertDateTime(src.getReleaseDateElement())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LITERAL: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LITERAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CarePlan30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CarePlan30_40.java new file mode 100644 index 000000000..b35cff895 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CarePlan30_40.java @@ -0,0 +1,433 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class CarePlan30_40 { + + private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category"; + + public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + } + if (src.hasAuthor()) { + tgt.addAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + } + for (org.hl7.fhir.r4.model.Reference t : src.getCareTeam()) { + tgt.addCareTeam(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) { + tgt.addAddresses(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { + tgt.addActivity(convertCarePlanActivityComponent(t)); + } + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + } + List authors = src.getAuthor(); + if (authors.size() > 0) { + tgt.setAuthor(VersionConvertor_30_40.convertReference(authors.get(0))); + if (authors.size() > 1) { + } + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) { + tgt.addCareTeam(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) { + tgt.addAddresses(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { + tgt.addActivity(convertCarePlanActivityComponent(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { + tgt.addOutcomeCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) { + tgt.addOutcomeReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) { + tgt.addProgress(VersionConvertor_30_40.convertAnnotation(t)); + } + if (src.hasReference()) { + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + } + if (src.hasDetail()) { + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { + tgt.addOutcomeCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) { + tgt.addOutcomeReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) { + tgt.addProgress(VersionConvertor_30_40.convertAnnotation(t)); + } + if (src.hasReference()) { + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + } + if (src.hasDetail()) { + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCategory()) { + org.hl7.fhir.r4.model.Extension t = new org.hl7.fhir.r4.model.Extension(); + t.setUrl(CarePlanActivityDetailComponentExtension); + t.setValue(VersionConvertor_30_40.convertType(src.getCategory())); + tgt.addExtension(t); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + } + if (src.hasStatusReason()) { + org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding(); + code.setCode(src.getStatusReason()); + org.hl7.fhir.r4.model.CodeableConcept t = new org.hl7.fhir.r4.model.CodeableConcept(code); + tgt.setStatusReason(t); + } + if (src.hasProhibited()) { + tgt.setDoNotPerform(src.getProhibited()); + } + if (src.hasScheduled()) { + tgt.setScheduled(VersionConvertor_30_40.convertType(src.getScheduled())); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) { + tgt.addPerformer(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasProduct()) { + tgt.setProduct(VersionConvertor_30_40.convertType(src.getProduct())); + } + if (src.hasDailyAmount()) { + tgt.setDailyAmount(VersionConvertor_30_40.convertSimpleQuantity(src.getDailyAmount())); + } + if (src.hasQuantity()) { + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasExtension()) { + org.hl7.fhir.r4.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension); + if (extension != null) { + org.hl7.fhir.r4.model.Type value = extension.getValue(); + if (value instanceof org.hl7.fhir.r4.model.CodeableConcept) { + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) value)); + } + } + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + } + if (src.hasStatusReason()) { + List coding = src.getStatusReason().getCoding(); + if (coding.size() > 0) { + tgt.setStatusReason(coding.get(0).getCode()); + } + } + if (src.hasDoNotPerform()) { + tgt.setProhibited(src.getDoNotPerform()); + } + if (src.hasScheduled()) { + tgt.setScheduled(VersionConvertor_30_40.convertType(src.getScheduled())); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + } + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) { + tgt.addPerformer(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasProduct()) { + tgt.setProduct(VersionConvertor_30_40.convertType(src.getProduct())); + } + if (src.hasDailyAmount()) { + tgt.setDailyAmount(VersionConvertor_30_40.convertSimpleQuantity(src.getDailyAmount())); + } + if (src.hasQuantity()) { + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus src) { + if (src == null) + return null; + switch(src) { + case CANCELLED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case NOTSTARTED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case SCHEDULED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) { + if (src == null) + return null; + switch(src) { + case CANCELLED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case NOTSTARTED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case ONHOLD: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case SCHEDULED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case UNKNOWN: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPTION: + return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.OPTION; + case ORDER: + return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.ORDER; + case PLAN: + return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PROPOSAL; + default: + return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPTION: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.OPTION; + case ORDER: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.ORDER; + case PLAN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PROPOSAL; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; + case REVOKED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ENTEREDINERROR; + case ONHOLD: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.SUSPENDED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED; + case COMPLETED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ENTEREDINERROR; + case SUSPENDED: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ONHOLD; + case UNKNOWN: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CareTeam30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CareTeam30_40.java new file mode 100644 index 000000000..df2f79ff8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CareTeam30_40.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CareTeam30_40 { + + public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r4.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getManagingOrganization()) tgt.addManagingOrganization(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CareTeam tgt = new org.hl7.fhir.r4.model.CareTeam(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) tgt.addManagingOrganization(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRoleFirstRep())); + if (src.hasMember()) + tgt.setMember(VersionConvertor_30_40.convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(VersionConvertor_30_40.convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasMember()) + tgt.setMember(VersionConvertor_30_40.convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(VersionConvertor_30_40.convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r4.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ClinicalImpression30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ClinicalImpression30_40.java new file mode 100644 index 000000000..6702ad1f0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ClinicalImpression30_40.java @@ -0,0 +1,159 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class ClinicalImpression30_40 { + + public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r4.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasAssessor()) + tgt.setAssessor(VersionConvertor_30_40.convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(VersionConvertor_30_40.convertReference(src.getPrevious())); + for (org.hl7.fhir.r4.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getProtocol()) tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPrognosisCodeableConcept()) tgt.addPrognosisCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPrognosisReference()) tgt.addPrognosisReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression tgt = new org.hl7.fhir.r4.model.ClinicalImpression(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasAssessor()) + tgt.setAssessor(VersionConvertor_30_40.convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(VersionConvertor_30_40.convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProtocol()) tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPrognosisCodeableConcept()) tgt.addPrognosisCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPrognosisReference()) tgt.addPrognosisReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItemCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(src.getItemCodeableConcept())); + if (src.hasItemReference()) + tgt.setItemReference(VersionConvertor_30_40.convertReference(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItemCodeableConcept())); + else if (src.hasItemReference()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) tgt.addItem(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.Reference t : src.getItem()) tgt.addItem(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CodeSystem30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CodeSystem30_40.java new file mode 100644 index 000000000..0913ba2a4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CodeSystem30_40.java @@ -0,0 +1,369 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CodeSystem30_40 { + + public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getOperator()) VersionConvertor_30_40.copyElement(t, tgt.addOperatorElement().setValue(VersionConvertor_30_40.convertFilterOperator(t.getValue()))); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getOperator()) VersionConvertor_30_40.copyElement(t, tgt.addOperatorElement().setValue(VersionConvertor_30_40.convertFilterOperator(t.getValue()))); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUPEDBY: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } + } + + static public org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUPEDBY: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: + return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_40.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_40.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.r4.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r4.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Communication30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Communication30_40.java new file mode 100644 index 000000000..93f91baf4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Communication30_40.java @@ -0,0 +1,144 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Communication30_40 { + + public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r4.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesCanonical()) tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + if (src.getStatus() == org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE) + tgt.setNotDone(true); + else + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setNotDoneReason(VersionConvertor_30_40.convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_30_40.convertReference(t)); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasSent()) + tgt.setSentElement(VersionConvertor_30_40.convertDateTime(src.getSentElement())); + if (src.hasReceived()) + tgt.setReceivedElement(VersionConvertor_30_40.convertDateTime(src.getReceivedElement())); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_40.convertReference(src.getSender())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Communication tgt = new org.hl7.fhir.r4.model.Communication(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiatesCanonical(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasNotDone()) + tgt.setStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE); + else if (src.hasStatus()) + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setStatusReason(VersionConvertor_30_40.convertCodeableConcept(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_30_40.convertReference(t)); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasSent()) + tgt.setSentElement(VersionConvertor_30_40.convertDateTime(src.getSentElement())); + if (src.hasReceived()) + tgt.setReceivedElement(VersionConvertor_30_40.convertDateTime(src.getReceivedElement())); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_40.convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(VersionConvertor_30_40.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(VersionConvertor_30_40.convertType(src.getContent())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; + case SUSPENDED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ONHOLD; + case ABORTED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.STOPPED; + case COMPLETED: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CompartmentDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CompartmentDefinition30_40.java new file mode 100644 index 000000000..972b09b5e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/CompartmentDefinition30_40.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class CompartmentDefinition30_40 { + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r4.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition tgt = new org.hl7.fhir.r4.model.CompartmentDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Composition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Composition30_40.java new file mode 100644 index 000000000..052c6ea67 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Composition30_40.java @@ -0,0 +1,333 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Composition30_40 { + + public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_30_40.convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_30_40.convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + if (src.hasTime()) + tgt.setTimeElement(VersionConvertor_30_40.convertDateTime(src.getTimeElement())); + if (src.hasParty()) + tgt.setParty(VersionConvertor_30_40.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + if (src.hasTime()) + tgt.setTimeElement(VersionConvertor_30_40.convertDateTime(src.getTimeElement())); + if (src.hasParty()) + tgt.setParty(VersionConvertor_30_40.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertType(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertType(src.getTarget())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case U: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.U; + case L: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.L; + case M: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.M; + case N: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.N; + case R: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.R; + case V: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.V; + default: + return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case U: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U; + case L: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L; + case M: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M; + case N: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N; + case R: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R; + case V: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V; + default: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(VersionConvertor_30_40.convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_30_40.convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(VersionConvertor_30_40.convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_30_40.convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.dstu3.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r4.model.Composition.SectionMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r4.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r4.model.Composition.SectionMode.CHANGES; + default: + return org.hl7.fhir.r4.model.Composition.SectionMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r4.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES; + default: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ConceptMap30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ConceptMap30_40.java new file mode 100644 index 000000000..d5cd47973 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ConceptMap30_40.java @@ -0,0 +1,343 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class ConceptMap30_40 { + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertType(src.getSource())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertType(src.getTarget())); + for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) { + org.hl7.fhir.r4.model.Type t = VersionConvertor_30_40.convertType(src.getSource()); + tgt.setSource(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); + } + if (src.hasTarget()) { + org.hl7.fhir.r4.model.Type t = VersionConvertor_30_40.convertType(src.getTarget()); + tgt.setTarget(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); + } + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RELATEDTO: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + static public org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RELATEDTO: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVIDED: + return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: + return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: + return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: + return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVIDED: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setCode(src.getValue()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setValue(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasEquivalence()) + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasEquivalence()) + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Condition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Condition30_40.java new file mode 100644 index 000000000..bc6d94a78 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Condition30_40.java @@ -0,0 +1,209 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Condition30_40 { + + private static final String CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL = "http://hl7.org/fhir/condition-ver-status"; + + private static final String CODE_SYSTEM_CONDITION_VER_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-ver-status"; + + private static final String CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL = "http://hl7.org/fhir/condition-clinical"; + + private static final String CODE_SYSTEM_CONDITION_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-clinical"; + + public static org.hl7.fhir.r4.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition tgt = new org.hl7.fhir.r4.model.Condition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(VersionConvertor_30_40.convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(VersionConvertor_30_40.convertType(src.getAbatement())); + if (src.hasAssertedDate()) + tgt.setRecordedDateElement(VersionConvertor_30_40.convertDateTime(src.getAssertedDateElement())); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_40.convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.r4.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(VersionConvertor_30_40.convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(VersionConvertor_30_40.convertType(src.getAbatement())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_40.convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus convertConditionClinicalStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "active") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "active")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.ACTIVE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "recurrence") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "recurrence")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RECURRENCE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "inactive") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "inactive")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.INACTIVE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "remission") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "remission")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.REMISSION; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "resolved") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "resolved")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.NULL; + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); + switch(src) { + case ACTIVE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("active"); + return cc; + case RECURRENCE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("recurrence"); + return cc; + case INACTIVE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("inactive"); + return cc; + case REMISSION: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("remission"); + return cc; + case RESOLVED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("resolved"); + return cc; + default: + return null; + } + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(VersionConvertor_30_40.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(VersionConvertor_30_40.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); + switch(src) { + case PROVISIONAL: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("entered-in-error"); + return cc; + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "provisional") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "provisional")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "differential") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "differential")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "confirmed") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "confirmed")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "refuted") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "refuted")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "entered-in-error") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "entered-in-error")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Consent30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Consent30_40.java new file mode 100644 index 000000000..361856a80 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Consent30_40.java @@ -0,0 +1,363 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CodeableConcept; + +import java.util.List; + +public class Consent30_40 { + + static public org.hl7.fhir.r4.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent tgt = new org.hl7.fhir.r4.model.Consent(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertConsentState(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasDateTime()) + tgt.setDateTimeElement(VersionConvertor_30_40.convertDateTime(src.getDateTimeElement())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getConsentingParty()) tgt.addPerformer(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getOrganization()) tgt.addOrganization(VersionConvertor_30_40.convertReference(t)); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertType(src.getSource())); + for (org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent t : src.getPolicy()) tgt.addPolicy(convertConsentPolicyComponent(t)); + if (src.hasPolicyRule()) { + org.hl7.fhir.r4.model.Coding c = new org.hl7.fhir.r4.model.Coding(); + c.setSystem(VersionConvertor_30_40.URN_IETF_RFC_3986); + c.setCode(src.getPolicyRule()); + tgt.setPolicyRule(new CodeableConcept(c)); + } + if (src.hasSecurityLabel() || src.hasPeriod() || src.hasActor() || src.hasAction() || src.hasPurpose() || src.hasDataPeriod() || src.hasData() || src.hasExcept()) { + org.hl7.fhir.r4.model.Consent.provisionComponent pc = new org.hl7.fhir.r4.model.Consent.provisionComponent(); + if (src.hasPeriod()) + pc.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent t : src.getActor()) pc.addActor(convertConsentActorComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) pc.addAction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) pc.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) pc.addPurpose(VersionConvertor_30_40.convertCoding(t)); + if (src.hasDataPeriod()) + pc.setDataPeriod(VersionConvertor_30_40.convertPeriod(src.getDataPeriod())); + for (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent t : src.getData()) pc.addData(convertConsentDataComponent(t)); + for (org.hl7.fhir.dstu3.model.Consent.ExceptComponent t : src.getExcept()) pc.addProvision(convertExceptComponent(t)); + tgt.setProvision(pc); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r4.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + List identifier = src.getIdentifier(); + if (identifier.size() > 0) { + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(identifier.get(0))); + if (identifier.size() > 1) { + } + } + if (src.hasStatus()) + tgt.setStatus(convertConsentState(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasDateTime()) + tgt.setDateTimeElement(VersionConvertor_30_40.convertDateTime(src.getDateTimeElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addConsentingParty(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOrganization()) tgt.addOrganization(VersionConvertor_30_40.convertReference(t)); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertType(src.getSource())); + for (org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent t : src.getPolicy()) tgt.addPolicy(convertConsentPolicyComponent(t)); + if (src.hasPolicyRule()) { + for (org.hl7.fhir.r4.model.Coding c : src.getPolicyRule().getCoding()) { + if (VersionConvertor_30_40.URN_IETF_RFC_3986.equals(c.getSystem())) { + tgt.setPolicyRule(c.getCode()); + break; + } + } + } + if (src.hasProvision()) { + org.hl7.fhir.r4.model.Consent.provisionComponent p = src.getProvision(); + if (p.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(p.getPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : p.getActor()) tgt.addActor(convertConsentActorComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : p.getAction()) tgt.addAction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Coding t : p.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : p.getPurpose()) tgt.addPurpose(VersionConvertor_30_40.convertCoding(t)); + if (p.hasDataPeriod()) + tgt.setDataPeriod(VersionConvertor_30_40.convertPeriod(p.getDataPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : p.getData()) tgt.addData(convertConsentDataComponent(t)); + for (org.hl7.fhir.r4.model.Consent.provisionComponent t : p.getProvision()) tgt.addExcept(convertExceptComponent(t)); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.provisionActorComponent convertConsentActorComponent(org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.provisionDataComponent convertConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: + return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: + return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: + return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: + return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: + return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL; + } + } + + static public org.hl7.fhir.r4.model.Consent.ConsentProvisionType convertConsentExceptType(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DENY: + return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.DENY; + case PERMIT: + return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.PERMIT; + default: + return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.r4.model.Consent.ConsentProvisionType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DENY: + return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.DENY; + case PERMIT: + return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.PERMIT; + default: + return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r4.model.Consent.ConsentState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.DRAFT; + case PROPOSED: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.ACTIVE; + case REJECTED: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.REJECTED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Consent.ConsentState.NULL; + } + } + + static public org.hl7.fhir.r4.model.Consent.ConsentState convertConsentState(org.hl7.fhir.dstu3.model.Consent.ConsentState src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r4.model.Consent.ConsentState.DRAFT; + case PROPOSED: + return org.hl7.fhir.r4.model.Consent.ConsentState.PROPOSED; + case ACTIVE: + return org.hl7.fhir.r4.model.Consent.ConsentState.ACTIVE; + case REJECTED: + return org.hl7.fhir.r4.model.Consent.ConsentState.REJECTED; + case INACTIVE: + return org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Consent.ConsentState.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Consent.ConsentState.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.provisionActorComponent convertExceptActorComponent(org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.r4.model.Consent.provisionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ExceptComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertConsentExceptType(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : src.getActor()) tgt.addActor(convertExceptActorComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getPurpose()) tgt.addPurpose(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getClass_()) tgt.addClass_(VersionConvertor_30_40.convertCoding(t)); + for (CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCoding(t)); + if (src.hasDataPeriod()) + tgt.setDataPeriod(VersionConvertor_30_40.convertPeriod(src.getDataPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : src.getData()) tgt.addData(convertExceptDataComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.provisionComponent convertExceptComponent(org.hl7.fhir.dstu3.model.Consent.ExceptComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertConsentExceptType(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent t : src.getActor()) tgt.addActor(convertExceptActorComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) tgt.addPurpose(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getClass_()) tgt.addClass_(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(new CodeableConcept(VersionConvertor_30_40.convertCoding(t))); + if (src.hasDataPeriod()) + tgt.setDataPeriod(VersionConvertor_30_40.convertPeriod(src.getDataPeriod())); + for (org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent t : src.getData()) tgt.addData(convertExceptDataComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Consent.provisionDataComponent convertExceptDataComponent(org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DataElement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DataElement30_40.java new file mode 100644 index 000000000..d86bcec7a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DataElement30_40.java @@ -0,0 +1,60 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DataElement30_40 { + + public static org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.getSnapshot().addElement(VersionConvertor_30_40.convertElementDefinition(t)); + tgt.setKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DetectedIssue30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DetectedIssue30_40.java new file mode 100644 index 000000000..785778390 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DetectedIssue30_40.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DetectedIssue30_40 { + + public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getIdentifiedDateTimeType())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_30_40.convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasDateElement()) + tgt.setIdentified(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_30_40.convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(VersionConvertor_30_40.convertCodeableConcept(src.getAction())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(VersionConvertor_30_40.convertCodeableConcept(src.getAction())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } + + static public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DeviceUseStatement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DeviceUseStatement30_40.java new file mode 100644 index 000000000..60206163a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DeviceUseStatement30_40.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DeviceUseStatement30_40 { + + public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOnElement(VersionConvertor_30_40.convertDateTime(src.getRecordedOnElement())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOnElement(VersionConvertor_30_40.convertDateTime(src.getRecordedOnElement())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addIndication(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: + return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DiagnosticReport30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DiagnosticReport30_40.java new file mode 100644 index 000000000..780b7df6d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DiagnosticReport30_40.java @@ -0,0 +1,153 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DiagnosticReport30_40 { + + public static org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DiagnosticReport tgt = new org.hl7.fhir.r4.model.DiagnosticReport(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addMedia(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addConclusionCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_30_40.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getConclusionCode()) tgt.addCodedDiagnosis(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_30_40.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(VersionConvertor_30_40.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(VersionConvertor_30_40.convertReference(src.getLink())); + return tgt; + } + + static public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DocumentReference30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DocumentReference30_40.java new file mode 100644 index 000000000..017f586a1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/DocumentReference30_40.java @@ -0,0 +1,266 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class DocumentReference30_40 { + + public static org.hl7.fhir.r4.model.InstantType convertDateTimeToInstant(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValueAsString()); + VersionConvertor_30_40.copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(VersionConvertor_30_40.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasDateElement()) + tgt.setCreatedElement(convertInstantToDateTime(src.getDateElement())); + if (src.hasAuthenticator()) + tgt.setAuthenticator(VersionConvertor_30_40.convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(VersionConvertor_30_40.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setDateElement(convertDateTimeToInstant(src.getCreatedElement())); + if (src.hasAuthenticator()) + tgt.setAuthenticator(VersionConvertor_30_40.convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(VersionConvertor_30_40.convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(VersionConvertor_30_40.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(VersionConvertor_30_40.convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(VersionConvertor_30_40.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(VersionConvertor_30_40.convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(VersionConvertor_30_40.convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(VersionConvertor_30_40.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r4.model.Reference t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.addEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(VersionConvertor_30_40.convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(VersionConvertor_30_40.convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(VersionConvertor_30_40.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Reference tgt = VersionConvertor_30_40.convertReference(src.getRef()); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_30_40.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()); + VersionConvertor_30_40.copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); + VersionConvertor_30_40.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Encounter30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Encounter30_40.java new file mode 100644 index 000000000..e2a894984 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Encounter30_40.java @@ -0,0 +1,321 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Encounter30_40 { + + public static org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_40.convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_40.convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_40.convertCoding(src.getClass_())); + for (org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_40.convertReference(src.getAppointmentFirstRep())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(VersionConvertor_30_40.convertDuration(src.getLength())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_40.convertDiagnosisComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_40.convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(VersionConvertor_30_40.convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_40.convertCoding(src.getClass_())); + for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.addAppointment(VersionConvertor_30_40.convertReference(src.getAppointment())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(VersionConvertor_30_40.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_40.convertDiagnosisComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_40.convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(VersionConvertor_30_40.convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(VersionConvertor_30_40.convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(VersionConvertor_30_40.convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(VersionConvertor_30_40.convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(VersionConvertor_30_40.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(VersionConvertor_30_40.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(VersionConvertor_30_40.convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(VersionConvertor_30_40.convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(VersionConvertor_30_40.convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(VersionConvertor_30_40.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(VersionConvertor_30_40.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(VersionConvertor_30_40.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(VersionConvertor_30_40.convertReference(src.getIndividual())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Endpoint30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Endpoint30_40.java new file mode 100644 index 000000000..d93784c0f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Endpoint30_40.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Endpoint30_40 { + + public static org.hl7.fhir.r4.model.Endpoint convertEndpoint(org.hl7.fhir.dstu3.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Endpoint tgt = new org.hl7.fhir.r4.model.Endpoint(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(VersionConvertor_30_40.convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPayloadType()) tgt.addPayloadType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getPayloadMimeType()) tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Endpoint convertEndpoint(org.hl7.fhir.r4.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Endpoint tgt = new org.hl7.fhir.dstu3.model.Endpoint(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(VersionConvertor_30_40.convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPayloadType()) tgt.addPayloadType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getPayloadMimeType()) tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ERROR; + case OFF: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.TEST; + default: + return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r4.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.TEST; + default: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/EpisodeOfCare30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/EpisodeOfCare30_40.java new file mode 100644 index 000000000..27c570a87 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/EpisodeOfCare30_40.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class EpisodeOfCare30_40 { + + public static org.hl7.fhir.r4.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare tgt = new org.hl7.fhir.r4.model.EpisodeOfCare(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_40.convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_30_40.convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(VersionConvertor_30_40.convertReference(src.getCareManager())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTeam()) tgt.addTeam(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r4.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_40.convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_30_40.convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(VersionConvertor_30_40.convertReference(src.getCareManager())); + for (org.hl7.fhir.r4.model.Reference t : src.getTeam()) tgt.addTeam(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ExpansionProfile30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ExpansionProfile30_40.java new file mode 100644 index 000000000..1d190c398 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ExpansionProfile30_40.java @@ -0,0 +1,112 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; +import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; +import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Type; + +public class ExpansionProfile30_40 { + + public static org.hl7.fhir.r4.model.Parameters convertExpansionProfile(org.hl7.fhir.dstu3.model.ExpansionProfile src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + if (src.hasUrl()) + tgt.addParameter("profile-url", src.getUrl()); + if (src.hasVersion()) + tgt.addParameter("profile-version", src.getVersion()); + if (src.hasName()) + tgt.addParameter("profile-name", src.getName()); + if (src.hasStatus()) + tgt.addParameter("profile-status", src.getStatus().toCode()); + for (org.hl7.fhir.dstu3.model.ExpansionProfile.ExpansionProfileFixedVersionComponent t : src.getFixedVersion()) { + if (t.getMode() == SystemVersionProcessingMode.DEFAULT) + tgt.addParameter("system-version", t.getSystem() + "|" + t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.CHECK) + tgt.addParameter("check-system-version", t.getSystem() + "|" + t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.OVERRIDE) + tgt.addParameter("force-system-version", t.getSystem() + "|" + t.getVersion()); + } + if (src.hasExcludedSystem()) { + tgt.addParameter("exclude-system", src.getExcludedSystem().getSystem() + "|" + src.getExcludedSystem().getVersion()); + } + if (src.hasIncludeDesignations()) + tgt.addParameter("includeDesignations", src.getIncludeDesignations()); + for (DesignationIncludeDesignationComponent t : src.getDesignation().getInclude().getDesignation()) { + if (t.hasLanguage()) + tgt.addParameter("designation", "urn:ietf:bcp:47|" + t.getLanguage()); + if (t.hasUse()) + tgt.addParameter("designation", t.getUse().getSystem() + "|" + t.getUse().getCode()); + } + if (src.hasIncludeDefinition()) + tgt.addParameter("includeDefinition", src.getIncludeDefinition()); + if (src.hasActiveOnly()) + tgt.addParameter("activeOnly", src.getActiveOnly()); + if (src.hasExcludeNested()) + tgt.addParameter("excludeNested", src.getExcludeNested()); + if (src.hasExcludeNotForUI()) + tgt.addParameter("excludeNotForUI", src.getExcludeNotForUI()); + if (src.hasExcludePostCoordinated()) + tgt.addParameter("excludePostCoordinated", src.getExcludePostCoordinated()); + if (src.hasDisplayLanguage()) + tgt.addParameter("excludePostCoordinated", src.getDisplayLanguage()); + if (src.hasLimitedExpansion()) + tgt.addParameter("limitedExpansion", src.getLimitedExpansion()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ExpansionProfile convertExpansionProfile(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile(); + if (src.hasParameter("profile-url")) + tgt.setUrl(src.getParameter("profile-url").primitiveValue()); + if (src.hasParameter("profile-version")) + tgt.setVersion(src.getParameter("profile-version").primitiveValue()); + if (src.hasParameter("profile-name")) + tgt.setName(src.getParameter("profile-name").primitiveValue()); + if (src.hasParameter("profile-status")) + tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue())); + for (Type t : src.getParameters("system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT); + } + for (Type t : src.getParameters("force-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE); + } + for (Type t : src.getParameters("check-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK); + } + for (Type t : src.getParameters("exclude-system")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]); + } + if (src.hasParameter("includeDesignations")) + tgt.setIncludeDesignations(src.getParameterBool("")); + for (Type t : src.getParameters("designation")) { + String[] v = t.primitiveValue().split("\\|"); + if ("urn:ietf:bcp:47".equals(v[0])) + tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]); + else + tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]); + } + if (src.hasParameter("includeDefinition")) + tgt.setIncludeDefinition(src.getParameterBool("includeDefinition")); + if (src.hasParameter("activeOnly")) + tgt.setActiveOnly(src.getParameterBool("activeOnly")); + if (src.hasParameter("excludeNested")) + tgt.setExcludeNested(src.getParameterBool("excludeNested")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("displayLanguage")) + tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue()); + if (src.hasParameter("limitedExpansion")) + tgt.setLimitedExpansion(src.getParameterBool("getParameterBool")); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/FamilyMemberHistory30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/FamilyMemberHistory30_40.java new file mode 100644 index 000000000..e7e129e11 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/FamilyMemberHistory30_40.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class FamilyMemberHistory30_40 { + + static public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesCanonical()) tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasDataAbsentReason()) + tgt.setNotDoneReason(VersionConvertor_30_40.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(VersionConvertor_30_40.convertCodeableConcept(src.getRelationship())); + if (src.hasBorn()) + tgt.setBorn(VersionConvertor_30_40.convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_40.convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_40.convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiatesCanonical(t.getReference()); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setDataAbsentReason(VersionConvertor_30_40.convertCodeableConcept(src.getNotDoneReason())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(VersionConvertor_30_40.convertCodeableConcept(src.getRelationship())); + if (src.hasBorn()) + tgt.setBorn(VersionConvertor_30_40.convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_40.convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_40.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_40.convertType(src.getOnset())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Flag30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Flag30_40.java new file mode 100644 index 000000000..32aebbf51 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Flag30_40.java @@ -0,0 +1,83 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Flag30_40 { + + public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.r4.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Flag tgt = new org.hl7.fhir.r4.model.Flag(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r4.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r4.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Flag.FlagStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Goal30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Goal30_40.java new file mode 100644 index 000000000..fd93dc4fe --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Goal30_40.java @@ -0,0 +1,161 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Goal30_40 { + + public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r4.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasLifecycleStatus()) + tgt.setStatus(convertGoalStatus(src.getLifecycleStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_40.convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_40.convertType(src.getStart())); + if (src.hasTarget()) + tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(VersionConvertor_30_40.convertDate(src.getStatusDateElement())); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(VersionConvertor_30_40.convertReference(src.getExpressedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCode()) tgt.addOutcomeCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) tgt.addOutcomeReference(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Goal tgt = new org.hl7.fhir.r4.model.Goal(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setLifecycleStatus(convertGoalStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_40.convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_40.convertType(src.getStart())); + if (src.hasTarget()) + tgt.addTarget(convertGoalTargetComponent(src.getTarget())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(VersionConvertor_30_40.convertDate(src.getStatusDateElement())); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(VersionConvertor_30_40.convertReference(src.getExpressedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) tgt.addOutcomeCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) tgt.addOutcomeReference(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus convertGoalStatus(org.hl7.fhir.dstu3.model.Goal.GoalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PROPOSED; + case ACCEPTED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACCEPTED; + case PLANNED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PLANNED; + case INPROGRESS: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case ONTARGET: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case AHEADOFTARGET: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case BEHINDTARGET: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case SUSTAINING: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case ACHIEVED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; + case REJECTED: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.REJECTED; + default: + return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Goal.GoalStatus convertGoalStatus(org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PROPOSED; + case ACCEPTED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACCEPTED; + case PLANNED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACHIEVED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ENTEREDINERROR; + case REJECTED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.REJECTED; + default: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r4.model.Goal.GoalTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_40.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_40.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_40.convertType(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r4.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_40.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_40.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_40.convertType(src.getDue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/GraphDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/GraphDefinition30_40.java new file mode 100644 index 000000000..b4603d489 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/GraphDefinition30_40.java @@ -0,0 +1,245 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class GraphDefinition30_40 { + + static public org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.DEVICE; + default: + return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE; + default: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL; + } + } + + static public org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IDENTICAL: + return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: + return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: + return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: + return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: + return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IDENTICAL: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r4.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertCode(src.getStartElement())); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition tgt = new org.hl7.fhir.r4.model.GraphDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertCode(src.getStartElement())); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Group30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Group30_40.java new file mode 100644 index 000000000..c9d1e2cc4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Group30_40.java @@ -0,0 +1,155 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Group30_40 { + + public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.r4.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r4.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group tgt = new org.hl7.fhir.r4.model.Group(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r4.model.Group.GroupMemberComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(VersionConvertor_30_40.convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r4.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(VersionConvertor_30_40.convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.r4.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.r4.model.Group.GroupType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/HealthcareService30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/HealthcareService30_40.java new file mode 100644 index 000000000..40e710023 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/HealthcareService30_40.java @@ -0,0 +1,152 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent; + +public class HealthcareService30_40 { + + public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.r4.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(VersionConvertor_30_40.convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_40.convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_40.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasEligibility()) { + tgt.setEligibility(VersionConvertor_30_40.convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + if (src.getEligibilityFirstRep().hasComment()) + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + } + for (CodeableConcept t : src.getProgram()) tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService tgt = new org.hl7.fhir.r4.model.HealthcareService(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(VersionConvertor_30_40.convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_40.convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_40.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasEligibility() || src.hasEligibilityNote()) { + HealthcareServiceEligibilityComponent t = tgt.addEligibility(); + t.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + t.setComment(src.getEligibilityNote()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_40.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_40.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_40.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_40.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImagingStudy30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImagingStudy30_40.java new file mode 100644 index 000000000..bd50189b5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImagingStudy30_40.java @@ -0,0 +1,295 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class ImagingStudy30_40 { + + private static final String URN_DICOM_UID = "urn:dicom:uid"; + + public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r4.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { + if (URN_DICOM_UID.equals(t.getSystem())) { + tgt.setUid(t.getValue()); + } else { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + } + if (src.hasStatus()) { + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus s = src.getStatus(); + switch(s) { + case REGISTERED: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE); + break; + case AVAILABLE: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE); + break; + case CANCELLED: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); + break; + default: + break; + } + } + for (org.hl7.fhir.r4.model.Coding t : src.getModality()) { + tgt.addModalityList(VersionConvertor_30_40.convertCoding(t)); + } + if (src.hasSubject()) { + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_40.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasReferrer()) { + tgt.setReferrer(VersionConvertor_30_40.convertReference(src.getReferrer())); + } + for (org.hl7.fhir.r4.model.Reference t : src.getInterpreter()) { + tgt.addInterpreter(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasNumberOfSeries()) { + tgt.setNumberOfSeries(src.getNumberOfSeries()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + if (src.hasProcedureReference()) { + tgt.addProcedureReference(VersionConvertor_30_40.convertReference(src.getProcedureReference())); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProcedureCode()) { + tgt.addProcedureCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + List reasonCodes = src.getReasonCode(); + if (reasonCodes.size() > 0) { + tgt.setReason(VersionConvertor_30_40.convertCodeableConcept(reasonCodes.get(0))); + if (reasonCodes.size() > 1) { + } + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { + tgt.addSeries(convertImagingStudySeriesComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy tgt = new org.hl7.fhir.r4.model.ImagingStudy(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUid()) { + org.hl7.fhir.r4.model.Identifier i = new org.hl7.fhir.r4.model.Identifier(); + i.setSystem(URN_DICOM_UID); + i.setValue(src.getUid()); + tgt.addIdentifier(i); + } + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + if (src.hasAccession()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getAccession())); + if (src.hasAvailability()) { + org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability availability = src.getAvailability(); + switch(availability) { + case OFFLINE: + tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.REGISTERED); + break; + case UNAVAILABLE: + tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.CANCELLED); + break; + case ONLINE: + case NEARLINE: + tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.AVAILABLE); + break; + default: + break; + } + } else { + tgt.setStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.UNKNOWN); + } + for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) { + tgt.addModality(VersionConvertor_30_40.convertCoding(t)); + } + if (src.hasPatient()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_40.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasReferrer()) { + tgt.setReferrer(VersionConvertor_30_40.convertReference(src.getReferrer())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) { + tgt.addInterpreter(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasNumberOfSeries()) { + tgt.setNumberOfSeries(src.getNumberOfSeries()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + List procedureReferences = src.getProcedureReference(); + if (procedureReferences.size() > 0) { + tgt.setProcedureReference(VersionConvertor_30_40.convertReference(procedureReferences.get(0))); + if (procedureReferences.size() > 1) { + } + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProcedureCode()) { + tgt.addProcedureCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasReason()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(src.getReason())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { + tgt.addSeries(convertImagingStudySeriesComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasModality()) { + tgt.setModality(VersionConvertor_30_40.convertCoding(src.getModality())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_40.convertCoding(src.getBodySite())); + } + if (src.hasLaterality()) { + tgt.setLaterality(VersionConvertor_30_40.convertCoding(src.getLaterality())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_40.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasModality()) { + tgt.setModality(VersionConvertor_30_40.convertCoding(src.getModality())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_40.convertCoding(src.getBodySite())); + } + if (src.hasLaterality()) { + tgt.setLaterality(VersionConvertor_30_40.convertCoding(src.getLaterality())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_40.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasSopClass()) { + org.hl7.fhir.r4.model.Coding c = new org.hl7.fhir.r4.model.Coding(); + c.setSystem(VersionConvertor_30_40.URN_IETF_RFC_3986); + c.setCode(src.getSopClass()); + tgt.setSopClass(c); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + org.hl7.fhir.r4.model.Coding sop = src.getSopClass(); + if (VersionConvertor_30_40.URN_IETF_RFC_3986.equals(sop.getSystem())) { + tgt.setSopClass(sop.getCode()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Immunization30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Immunization30_40.java new file mode 100644 index 000000000..3f32b3bc7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Immunization30_40.java @@ -0,0 +1,137 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Immunization30_40 { + + public static org.hl7.fhir.r4.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization tgt = new org.hl7.fhir.r4.model.Immunization(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(VersionConvertor_30_40.convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasDateElement()) + tgt.setOccurrence(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasReportOrigin()) + tgt.setReportOrigin(VersionConvertor_30_40.convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_40.convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(VersionConvertor_30_40.convertDate(src.getExpirationDateElement())); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_40.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_40.convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent t : src.getPractitioner()) tgt.addPerformer(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReason()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r4.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(VersionConvertor_30_40.convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasOccurrenceDateTimeType()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getOccurrenceDateTimeType())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasReportOrigin()) + tgt.setReportOrigin(VersionConvertor_30_40.convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_40.convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(VersionConvertor_30_40.convertDate(src.getExpirationDateElement())); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_40.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_40.convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) tgt.addPractitioner(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.getExplanation().addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasFunction()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setFunction(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r4.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImplementationGuide30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImplementationGuide30_40.java new file mode 100644 index 000000000..27a6ac578 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ImplementationGuide30_40.java @@ -0,0 +1,269 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Enumeration; + +import java.util.List; + +public class ImplementationGuide30_40 { + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + break; + } + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) { + findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + } + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.getDefinition().hasPage()) + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.hasPage()) + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + tgt.setId(src.getId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasExampleFor()) { + org.hl7.fhir.r4.model.Type t = VersionConvertor_30_40.convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r4.model.Reference ? new org.hl7.fhir.r4.model.CanonicalType(((org.hl7.fhir.r4.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r4.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_30_40.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r4.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(VersionConvertor_30_40.convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration convertPageGeneration(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind kind) { + switch(kind) { + case PAGE: + return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.HTML; + default: + return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.GENERATED; + } + } + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertPageGeneration(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration generation) { + switch(generation) { + case HTML: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + } + } + + public static org.hl7.fhir.r4.model.UrlType convertUriToUrl(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); + VersionConvertor_30_40.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (t.getId().equals(id)) + return t; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t1.setName("Default Package"); + t1.setId(id); + return t1; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Library30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Library30_40.java new file mode 100644 index 000000000..644ddaac2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Library30_40.java @@ -0,0 +1,140 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class Library30_40 { + + public static org.hl7.fhir.dstu3.model.Library convertLibrary(org.hl7.fhir.r4.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Library tgt = new org.hl7.fhir.dstu3.model.Library(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(VersionConvertor_30_40.convertParameterDefinition(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getContent()) tgt.addContent(VersionConvertor_30_40.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Library tgt = new org.hl7.fhir.r4.model.Library(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_40.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(VersionConvertor_30_40.convertParameterDefinition(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) tgt.addContent(VersionConvertor_30_40.convertAttachment(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Linkage30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Linkage30_40.java new file mode 100644 index 000000000..86f1e76b9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Linkage30_40.java @@ -0,0 +1,87 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Linkage30_40 { + + public static org.hl7.fhir.r4.model.Linkage convertLinkage(org.hl7.fhir.dstu3.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Linkage tgt = new org.hl7.fhir.r4.model.Linkage(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent t : src.getItem()) tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage convertLinkage(org.hl7.fhir.r4.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage tgt = new org.hl7.fhir.dstu3.model.Linkage(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Linkage.LinkageItemComponent t : src.getItem()) tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r4.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r4.model.Linkage.LinkageItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertReference(src.getResource())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.dstu3.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r4.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: + return org.hl7.fhir.r4.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: + return org.hl7.fhir.r4.model.Linkage.LinkageType.HISTORICAL; + default: + return org.hl7.fhir.r4.model.Linkage.LinkageType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r4.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.HISTORICAL; + default: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/List30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/List30_40.java new file mode 100644 index 000000000..aad07829e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/List30_40.java @@ -0,0 +1,161 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class List30_40 { + + public static org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(VersionConvertor_30_40.convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(VersionConvertor_30_40.convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertReference(src.getItem())); + return tgt; + } + + static public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; + default: + return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Location30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Location30_40.java new file mode 100644 index 000000000..f5f20ec44 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Location30_40.java @@ -0,0 +1,159 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Location30_40 { + + public static org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Location tgt = new org.hl7.fhir.r4.model.Location(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(VersionConvertor_30_40.convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.addType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(VersionConvertor_30_40.convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.r4.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(VersionConvertor_30_40.convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(VersionConvertor_30_40.convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r4.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.r4.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.r4.model.Location.LocationMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r4.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r4.model.Location.LocationPositionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r4.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Media30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Media30_40.java new file mode 100644 index 000000000..bc0794a6e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Media30_40.java @@ -0,0 +1,145 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.CodeableConcept; + +public class Media30_40 { + + private static final String CODE_SYSTEM_MEDIA_TYPE = "http://terminology.hl7.org/CodeSystem/media-type"; + + public static org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.r4.model.Media src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasType()) { + CodeableConcept type = src.getType(); + for (org.hl7.fhir.r4.model.Coding c : type.getCoding()) { + if (CODE_SYSTEM_MEDIA_TYPE.equals(c.getSystem())) { + tgt.setType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.fromCode(c.getCode().replace("image", "photo"))); + break; + } + } + } + if (src.hasModality()) { + tgt.setSubtype(VersionConvertor_30_40.convertCodeableConcept(src.getModality())); + } + if (src.hasView()) { + tgt.setView(VersionConvertor_30_40.convertCodeableConcept(src.getView())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + } + if (src.hasCreated()) { + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getCreated())); + } + if (src.hasOperator()) { + tgt.setOperator(VersionConvertor_30_40.convertReference(src.getOperator())); + } + for (CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + } + if (src.hasDevice()) { + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + } + if (src.hasHeight()) { + tgt.setHeight(src.getHeight()); + } + if (src.hasWidth()) { + tgt.setWidth(src.getWidth()); + } + if (src.hasFrames()) { + tgt.setFrames(src.getFrames()); + } + if (src.hasDuration()) { + tgt.setDuration(src.getDuration().intValue()); + } + if (src.hasContent()) { + tgt.setContent(VersionConvertor_30_40.convertAttachment(src.getContent())); + } + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Media tgt = new org.hl7.fhir.r4.model.Media(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasType()) { + org.hl7.fhir.r4.model.Coding coding = new org.hl7.fhir.r4.model.Coding(); + coding.setSystem(CODE_SYSTEM_MEDIA_TYPE); + coding.setCode(src.getType().toCode().replace("photo", "image")); + CodeableConcept codeableConcept = new CodeableConcept(coding); + tgt.setType(codeableConcept); + } + if (src.hasSubtype()) { + tgt.setModality(VersionConvertor_30_40.convertCodeableConcept(src.getSubtype())); + } + if (src.hasView()) { + tgt.setView(VersionConvertor_30_40.convertCodeableConcept(src.getView())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + } + if (src.hasOccurrence()) { + tgt.setCreated(VersionConvertor_30_40.convertType(src.getOccurrence())); + } + if (src.hasOperator()) { + tgt.setOperator(VersionConvertor_30_40.convertReference(src.getOperator())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + } + if (src.hasDevice()) { + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + } + if (src.hasHeight()) { + tgt.setHeight(src.getHeight()); + } + if (src.hasWidth()) { + tgt.setWidth(src.getWidth()); + } + if (src.hasFrames()) { + tgt.setFrames(src.getFrames()); + } + if (src.hasDuration()) { + tgt.setDuration(src.getDuration()); + } + if (src.hasContent()) { + tgt.setContent(VersionConvertor_30_40.convertAttachment(src.getContent())); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + tgt.setStatus(org.hl7.fhir.r4.model.Media.MediaStatus.COMPLETED); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Medication30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Medication30_40.java new file mode 100644 index 000000000..674e5153f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Medication30_40.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Medication30_40 { + + public static org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication tgt = new org.hl7.fhir.r4.model.Medication(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_40.convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(VersionConvertor_30_40.convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasPackage()) + tgt.setBatch(convertMedicationPackageBatchComponent(src.getPackage().getBatchFirstRep())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.r4.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_40.convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(VersionConvertor_30_40.convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasBatch()) + tgt.getPackage().addBatch(convertMedicationPackageBatchComponent(src.getBatch())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasStrength()) + tgt.setAmount(VersionConvertor_30_40.convertRatio(src.getStrength())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasAmount()) + tgt.setStrength(VersionConvertor_30_40.convertRatio(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.r4.model.Medication.MedicationBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(VersionConvertor_30_40.convertDateTime(src.getExpirationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Medication.MedicationBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationBatchComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(VersionConvertor_30_40.convertDateTime(src.getExpirationDateElement())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r4.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.dstu3.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r4.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Medication.MedicationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Medication.MedicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationAdministration30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationAdministration30_40.java new file mode 100644 index 000000000..9e7d8ca26 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationAdministration30_40.java @@ -0,0 +1,147 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationAdministration30_40 { + + public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r4.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) tgt.addDefinition().setReference(t.getValue()); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + for (org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + if (src.hasRequest()) + tgt.setPrescription(VersionConvertor_30_40.convertReference(src.getRequest())); + for (org.hl7.fhir.r4.model.Reference t : src.getDevice()) tgt.addDevice(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.dstu3.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration tgt = new org.hl7.fhir.r4.model.MedicationAdministration(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiates(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + for (org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + if (src.hasPrescription()) + tgt.setRequest(VersionConvertor_30_40.convertReference(src.getPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDevice()) tgt.addDevice(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_40.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_40.convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(VersionConvertor_30_40.convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(VersionConvertor_30_40.convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_40.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_40.convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(VersionConvertor_30_40.convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(VersionConvertor_30_40.convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus convertMedicationAdministrationStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus.fromCode(src); + } + + static public String convertMedicationAdministrationStatus(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationDispense30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationDispense30_40.java new file mode 100644 index 000000000..7e67ddfb5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationDispense30_40.java @@ -0,0 +1,151 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationDispense30_40 { + + public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_30_40.convertReference(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(VersionConvertor_30_40.convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPreparedElement(VersionConvertor_30_40.convertDateTime(src.getWhenPreparedElement())); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOverElement(VersionConvertor_30_40.convertDateTime(src.getWhenHandedOverElement())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_40.convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_30_40.convertReference(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(VersionConvertor_30_40.convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPreparedElement(VersionConvertor_30_40.convertDateTime(src.getWhenPreparedElement())); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOverElement(VersionConvertor_30_40.convertDateTime(src.getWhenHandedOverElement())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_40.convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); + } + + static public String convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); + } + + public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) tgt.addResponsibleParty(VersionConvertor_30_40.convertReference(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationRequest30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationRequest30_40.java new file mode 100644 index 000000000..bd8a9dde3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationRequest30_40.java @@ -0,0 +1,267 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationRequest30_40 { + + public static org.hl7.fhir.r4.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest tgt = new org.hl7.fhir.r4.model.MedicationRequest(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(VersionConvertor_30_40.convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredOnElement())); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_40.convertReference(src.getRecorder())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_40.convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(VersionConvertor_30_40.convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r4.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(VersionConvertor_30_40.convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_40.convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredOnElement())); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_40.convertReference(src.getRecorder())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_40.convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(VersionConvertor_30_40.convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(VersionConvertor_30_40.convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(VersionConvertor_30_40.convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(VersionConvertor_30_40.convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(VersionConvertor_30_40.convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSAL: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL; + } + } + + static public org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSAL: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.NULL; + } + } + + static public org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.URGENT; + case STAT: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.STAT; + case ASAP: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ASAP; + default: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT; + case STAT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT; + case ASAP: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL; + } + } + + static public org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAllowedBooleanType()) + tgt.setAllowedElement(VersionConvertor_30_40.convertBoolean(src.getAllowedBooleanType())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_40.convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAllowed()) + tgt.setAllowed(VersionConvertor_30_40.convertBoolean(src.getAllowedElement())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_40.convertCodeableConcept(src.getReason())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationStatement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationStatement30_40.java new file mode 100644 index 000000000..6b22144e4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MedicationStatement30_40.java @@ -0,0 +1,113 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationStatement30_40 { + + public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAssertedElement(VersionConvertor_30_40.convertDateTime(src.getDateAssertedElement())); + if (src.hasInformationSource()) + tgt.setInformationSource(VersionConvertor_30_40.convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) tgt.addDerivedFrom(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_40.convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasContext()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_40.convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAssertedElement(VersionConvertor_30_40.convertDateTime(src.getDateAssertedElement())); + if (src.hasInformationSource()) + tgt.setInformationSource(VersionConvertor_30_40.convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) tgt.addDerivedFrom(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_40.convertDosage(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + default: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + default: + return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageDefinition30_40.java new file mode 100644 index 000000000..eb35738db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageDefinition30_40.java @@ -0,0 +1,187 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageDefinition30_40 { + + public static org.hl7.fhir.dstu3.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r4.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition tgt = new org.hl7.fhir.dstu3.model.MessageDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_30_40.convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getParent()) tgt.addParent(VersionConvertor_30_40.convertCanonicalToReference(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getReplaces()) tgt.addReplaces(VersionConvertor_30_40.convertCanonicalToReference(t)); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_30_40.convertCoding(src.getEventCoding())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() != org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.dstu3.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition tgt = new org.hl7.fhir.r4.model.MessageDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBaseElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.getParent().add(VersionConvertor_30_40.convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) tgt.getReplaces().add(VersionConvertor_30_40.convertReferenceToCanonical(t)); + if (src.hasEvent()) + tgt.setEvent(VersionConvertor_30_40.convertCoding(src.getEvent())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() ? org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS : org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessage(VersionConvertor_30_40.convertCanonicalToReference(src.getMessageElement())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessageElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getMessage())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getProfile())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCanonicalToReference(src.getProfileElement())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NULL; + } + } + + static public org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageHeader30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageHeader30_40.java new file mode 100644 index 000000000..d265ecaff --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/MessageHeader30_40.java @@ -0,0 +1,181 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageHeader30_40 { + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_30_40.convertCoding(src.getEventCoding())); + for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_40.convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(VersionConvertor_30_40.convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(VersionConvertor_30_40.convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_40.convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) tgt.addFocus(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasEvent()) + tgt.setEvent(VersionConvertor_30_40.convertCoding(src.getEvent())); + for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_40.convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(VersionConvertor_30_40.convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(VersionConvertor_30_40.convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_40.convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) tgt.addFocus(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_40.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_40.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(VersionConvertor_30_40.convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(VersionConvertor_30_40.convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + } + } + + static public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/NamingSystem30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/NamingSystem30_40.java new file mode 100644 index 000000000..175a529f6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/NamingSystem30_40.java @@ -0,0 +1,167 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem30_40 { + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + static public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Observation30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Observation30_40.java new file mode 100644 index 000000000..60f1cd55c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Observation30_40.java @@ -0,0 +1,229 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Observation30_40 { + + public static org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_30_40.convertReference(t)); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_40.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(VersionConvertor_30_40.convertCodeableConcept(src.getInterpretation())); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_40.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(VersionConvertor_30_40.convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(VersionConvertor_30_40.convertReference(t.getTarget())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_40.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_30_40.convertReference(t)); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_40.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(VersionConvertor_30_40.convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_40.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHasMember()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_40.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(VersionConvertor_30_40.convertCodeableConcept(src.getInterpretationFirstRep())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_40.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(VersionConvertor_30_40.convertCodeableConcept(src.getInterpretation())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(VersionConvertor_30_40.convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(VersionConvertor_30_40.convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_40.convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(VersionConvertor_30_40.convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(VersionConvertor_30_40.convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_40.convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Reference src, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(VersionConvertor_30_40.convertReference(src)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationDefinition30_40.java new file mode 100644 index 000000000..638664656 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationDefinition30_40.java @@ -0,0 +1,267 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Type; + +public class OperationDefinition30_40 { + + public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBaseElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_30_40.convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.StringType t : src.getParameterName()) tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParameterName()) tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(VersionConvertor_30_40.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(VersionConvertor_30_40.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + Type t = VersionConvertor_30_40.convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r4.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasSearchType()) + tgt.setSearchType(VersionConvertor_30_40.convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r4.model.UriType t : src.getTargetProfile()) tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasSearchType()) + tgt.setSearchType(VersionConvertor_30_40.convertSearchParamType(src.getSearchType())); + if (src.hasProfile()) + tgt.addTargetProfile(src.getProfile().getReference()); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationOutcome30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationOutcome30_40.java new file mode 100644 index 000000000..1b6cdad99 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/OperationOutcome30_40.java @@ -0,0 +1,229 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome30_40 { + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + static public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_40.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_40.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Organization30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Organization30_40.java new file mode 100644 index 000000000..c1af520f9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Organization30_40.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Organization30_40 { + + public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_40.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(VersionConvertor_30_40.convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(VersionConvertor_30_40.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(VersionConvertor_30_40.convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(VersionConvertor_30_40.convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java new file mode 100644 index 000000000..e384d3bd7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java @@ -0,0 +1,55 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters30_40 { + + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + VersionConvertor_30_40.copyResource(src, tgt); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + VersionConvertor_30_40.copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false)); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false)); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Patient30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Patient30_40.java new file mode 100644 index 000000000..c7892613f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Patient30_40.java @@ -0,0 +1,224 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Patient30_40 { + + public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Extension convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", VersionConvertor_30_40.convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", VersionConvertor_30_40.convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", VersionConvertor_30_40.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(VersionConvertor_30_40.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_40.convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(VersionConvertor_30_40.convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_40.convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_40.convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + case REPLACES: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACES; + case REFER: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; + case REPLACES: + return org.hl7.fhir.r4.model.Patient.LinkType.REPLACES; + case REFER: + return org.hl7.fhir.r4.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.r4.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.r4.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_40.convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(VersionConvertor_30_40.convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(VersionConvertor_30_40.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + for (org.hl7.fhir.r4.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGeneralPractitioner()) tgt.addGeneralPractitioner(VersionConvertor_30_40.convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r4.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient tgt = new org.hl7.fhir.r4.model.Patient(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_40.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(VersionConvertor_30_40.convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(VersionConvertor_30_40.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) tgt.addGeneralPractitioner(VersionConvertor_30_40.convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(VersionConvertor_30_40.convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(VersionConvertor_30_40.convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r4.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(VersionConvertor_30_40.convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(VersionConvertor_30_40.convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PaymentNotice30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PaymentNotice30_40.java new file mode 100644 index 000000000..d66feaac6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PaymentNotice30_40.java @@ -0,0 +1,91 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class PaymentNotice30_40 { + + public static org.hl7.fhir.r4.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PaymentNotice tgt = new org.hl7.fhir.r4.model.PaymentNotice(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(VersionConvertor_30_40.convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(VersionConvertor_30_40.convertReference(src.getResponse())); + if (src.hasStatusDate()) + tgt.setPaymentDateElement(VersionConvertor_30_40.convertDate(src.getStatusDateElement())); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDateTime(src.getCreatedElement())); + if (src.hasTarget()) + tgt.setRecipient(VersionConvertor_30_40.convertReference(src.getTarget())); + if (src.hasProvider()) + tgt.setProvider(VersionConvertor_30_40.convertReference(src.getProvider())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(VersionConvertor_30_40.convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r4.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(VersionConvertor_30_40.convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(VersionConvertor_30_40.convertReference(src.getResponse())); + if (src.hasPaymentDate()) + tgt.setStatusDateElement(VersionConvertor_30_40.convertDate(src.getPaymentDateElement())); + if (src.hasCreated()) + tgt.setCreatedElement(VersionConvertor_30_40.convertDateTime(src.getCreatedElement())); + if (src.hasRecipient()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getRecipient())); + if (src.hasProvider()) + tgt.setProvider(VersionConvertor_30_40.convertReference(src.getProvider())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(VersionConvertor_30_40.convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + static public org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: + return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Person30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Person30_40.java new file mode 100644 index 000000000..1fe7bbe88 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Person30_40.java @@ -0,0 +1,111 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Person30_40 { + + static public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Person tgt = new org.hl7.fhir.r4.model.Person(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_40.convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.r4.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_40.convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_40.convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r4.model.Person.PersonLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r4.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_40.convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PlanDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PlanDefinition30_40.java new file mode 100644 index 000000000..bcb3b4f42 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PlanDefinition30_40.java @@ -0,0 +1,683 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class PlanDefinition30_40 { + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SINGLE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SINGLE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPLICABILITY: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START; + case STOP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPLICABILITY: + return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: + return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.START; + case STOP: + return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.STOP; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VISUALGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VISUALGROUP: + return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: + return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: + return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case YES: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case YES: + return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: + return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BEFORESTART: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BEFORESTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MUST: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MUST: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.NULL; + } + } + + static public org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ANY: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: + return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ANY: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL; + } + } + + public static org.hl7.fhir.r4.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition tgt = new org.hl7.fhir.r4.model.PlanDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_40.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_40.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(VersionConvertor_30_40.convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r4.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_40.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) tgt.addLibrary(VersionConvertor_30_40.convertCanonicalToReference(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLabel()) + tgt.setPrefix(src.getLabel()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) tgt.addTrigger(VersionConvertor_30_40.convertTriggerDefinition(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.getType().addCoding(VersionConvertor_30_40.convertCoding(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_40.convertReferenceToCanonical(src.getDefinition())); + if (src.hasTransform()) + tgt.setTransformElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setLabel(src.getPrefix()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.r4.model.TriggerDefinition t : src.getTrigger()) tgt.addTriggerDefinition(VersionConvertor_30_40.convertTriggerDefinition(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_40.convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_40.convertType(src.getTiming())); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCoding(src.getType().getCodingFirstRep())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinitionCanonicalType()) + tgt.setDefinition(VersionConvertor_30_40.convertCanonicalToReference(src.getDefinitionCanonicalType())); + if (src.hasTransform()) + tgt.setTransform(VersionConvertor_30_40.convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(VersionConvertor_30_40.convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(VersionConvertor_30_40.convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_40.convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_40.convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_40.convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_40.convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_40.convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_40.convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_40.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_40.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_40.convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_40.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_40.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_40.convertDuration(src.getDue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Practitioner30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Practitioner30_40.java new file mode 100644 index 000000000..d8994d096 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Practitioner30_40.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Practitioner30_40 { + + public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(VersionConvertor_30_40.convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_30_40.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(VersionConvertor_30_40.convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(VersionConvertor_30_40.convertReference(src.getIssuer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PractitionerRole30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PractitionerRole30_40.java new file mode 100644 index 000000000..a588f942b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/PractitionerRole30_40.java @@ -0,0 +1,115 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class PractitionerRole30_40 { + + public static org.hl7.fhir.r4.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole tgt = new org.hl7.fhir.r4.model.PractitionerRole(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(VersionConvertor_30_40.convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_40.convertReference(src.getOrganization())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) tgt.addHealthcareService(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r4.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole tgt = new org.hl7.fhir.dstu3.model.PractitionerRole(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(VersionConvertor_30_40.convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_40.convertReference(src.getOrganization())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) tgt.addHealthcareService(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_40.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_40.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_40.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_40.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_40.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Procedure30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Procedure30_40.java new file mode 100644 index 000000000..ae41b6008 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Procedure30_40.java @@ -0,0 +1,282 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Procedure30_40 { + + static public org.hl7.fhir.r4.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure tgt = new org.hl7.fhir.r4.model.Procedure(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + } + if (src.getNotDone()) { + tgt.setStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NOTDONE); + } else { + tgt.setStatus(convertProcedureStatus(src.getStatus())); + } + if (src.hasNotDoneReason()) { + tgt.setStatusReason(VersionConvertor_30_40.convertCodeableConcept(src.getNotDoneReason())); + } + if (src.hasCategory()) { + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + } + if (src.hasPerformed()) { + tgt.setPerformed(VersionConvertor_30_40.convertType(src.getPerformed())); + } + for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) { + tgt.addPerformer(convertProcedurePerformerComponent(t)); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) { + tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasOutcome()) { + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) { + tgt.addReport(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) { + tgt.addComplication(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getComplicationDetail()) { + tgt.addComplicationDetail(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) { + tgt.addFollowUp(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) { + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getUsedReference()) { + tgt.addUsedReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getUsedCode()) { + tgt.addUsedCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.r4.model.Procedure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasStatus()) { + org.hl7.fhir.r4.model.Procedure.ProcedureStatus status = src.getStatus(); + if (org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NOTDONE.equals(status)) { + tgt.setStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.SUSPENDED); + tgt.setNotDone(true); + tgt.setNotDoneReason(VersionConvertor_30_40.convertCodeableConcept(src.getStatusReason())); + } else { + tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setNotDone(false); + } + } + if (src.hasCategory()) { + tgt.setCategory(VersionConvertor_30_40.convertCodeableConcept(src.getCategory())); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + } + if (src.hasPerformed()) { + tgt.setPerformed(VersionConvertor_30_40.convertType(src.getPerformed())); + } + for (org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) { + tgt.addPerformer(convertProcedurePerformerComponent(t)); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) { + tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasOutcome()) { + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReport()) { + tgt.addReport(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getComplication()) { + tgt.addComplication(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getComplicationDetail()) { + tgt.addComplicationDetail(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFollowUp()) { + tgt.addFollowUp(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + for (org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) { + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getUsedReference()) { + tgt.addUsedReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getUsedCode()) { + tgt.addUsedCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAction()) { + tgt.setAction(VersionConvertor_30_40.convertCodeableConcept(src.getAction())); + } + if (src.hasManipulated()) { + tgt.setManipulated(VersionConvertor_30_40.convertReference(src.getManipulated())); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAction()) { + tgt.setAction(VersionConvertor_30_40.convertCodeableConcept(src.getAction())); + } + if (src.hasManipulated()) { + tgt.setManipulated(VersionConvertor_30_40.convertReference(src.getManipulated())); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) { + tgt.setFunction(VersionConvertor_30_40.convertCodeableConcept(src.getRole())); + } + if (src.hasActor()) { + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + } + if (src.hasOnBehalfOf()) { + tgt.setOnBehalfOf(VersionConvertor_30_40.convertReference(src.getOnBehalfOf())); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasFunction()) { + tgt.setRole(VersionConvertor_30_40.convertCodeableConcept(src.getFunction())); + } + if (src.hasActor()) { + tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor())); + } + if (src.hasOnBehalfOf()) { + tgt.setOnBehalfOf(VersionConvertor_30_40.convertReference(src.getOnBehalfOf())); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS; + case SUSPENDED: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ONHOLD; + case ABORTED: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.STOPPED; + case COMPLETED: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.SUSPENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ProcedureRequest30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ProcedureRequest30_40.java new file mode 100644 index 000000000..3d4c31d53 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ProcedureRequest30_40.java @@ -0,0 +1,313 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class ProcedureRequest30_40 { + + static public org.hl7.fhir.r4.model.ServiceRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ServiceRequest tgt = new org.hl7.fhir.r4.model.ServiceRequest(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasRequisition()) { + tgt.setRequisition(VersionConvertor_30_40.convertIdentifier(src.getRequisition())); + } + if (src.hasStatus()) { + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertProcedureRequestIntent(src.getIntent())); + } + if (src.hasPriority()) { + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + } + if (src.hasDoNotPerform()) { + tgt.setDoNotPerform(src.getDoNotPerform()); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + } + if (src.hasOccurrence()) { + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + } + if (src.hasAsNeeded()) { + tgt.setAsNeeded(VersionConvertor_30_40.convertType(src.getAsNeeded())); + } + if (src.hasAuthoredOn()) { + tgt.setAuthoredOnElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredOnElement())); + } + if (src.hasRequester()) { + org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestRequesterComponent requester = src.getRequester(); + if (requester.hasAgent()) { + tgt.setRequester(VersionConvertor_30_40.convertReference(requester.getAgent())); + } + } + if (src.hasPerformerType()) { + tgt.setPerformerType(VersionConvertor_30_40.convertCodeableConcept(src.getPerformerType())); + } + if (src.hasPerformer()) { + tgt.addPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) { + tgt.addSpecimen(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) { + tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getRelevantHistory()) { + tgt.addRelevantHistory(VersionConvertor_30_40.convertReference(t)); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.r4.model.ServiceRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_40.convertReference(t)); + } + if (src.hasRequisition()) { + tgt.setRequisition(VersionConvertor_30_40.convertIdentifier(src.getRequisition())); + } + if (src.hasStatus()) { + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertProcedureRequestIntent(src.getIntent())); + } + if (src.hasPriority()) { + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + } + if (src.hasDoNotPerform()) { + tgt.setDoNotPerform(src.getDoNotPerform()); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + } + if (src.hasOccurrence()) { + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + } + if (src.hasAsNeeded()) { + tgt.setAsNeeded(VersionConvertor_30_40.convertType(src.getAsNeeded())); + } + if (src.hasAuthoredOn()) { + tgt.setAuthoredOnElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredOnElement())); + } + if (src.hasRequester()) { + tgt.setRequester(new org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestRequesterComponent(VersionConvertor_30_40.convertReference(src.getRequester()))); + } + if (src.hasPerformerType()) { + tgt.setPerformerType(VersionConvertor_30_40.convertCodeableConcept(src.getPerformerType())); + } + List performers = src.getPerformer(); + if (performers.size() > 0) { + tgt.setPerformer(VersionConvertor_30_40.convertReference(performers.get(0))); + if (performers.size() > 1) { + } + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReasonCode(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { + tgt.addReasonReference(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) { + tgt.addSpecimen(VersionConvertor_30_40.convertReference(t)); + } + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) { + tgt.addBodySite(VersionConvertor_30_40.convertCodeableConcept(t)); + } + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + } + for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) { + tgt.addRelevantHistory(VersionConvertor_30_40.convertReference(t)); + } + return tgt; + } + + static public org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent convertProcedureRequestIntent(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent src) { + if (src == null) + return null; + switch(src) { + case FILLERORDER: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.FILLERORDER; + case INSTANCEORDER: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.INSTANCEORDER; + case OPTION: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.OPTION; + case ORDER: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORDER; + case ORIGINALORDER: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORIGINALORDER; + case PLAN: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PROPOSAL; + case REFLEXORDER: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.REFLEXORDER; + default: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent convertProcedureRequestIntent(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent src) { + if (src == null) + return null; + switch(src) { + case DIRECTIVE: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.NULL; + case FILLERORDER: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.FILLERORDER; + case INSTANCEORDER: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.INSTANCEORDER; + case OPTION: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.OPTION; + case ORDER: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.ORDER; + case ORIGINALORDER: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.ORIGINALORDER; + case PLAN: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.PROPOSAL; + case REFLEXORDER: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.REFLEXORDER; + default: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority src) { + if (src == null) + return null; + switch(src) { + case ASAP: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + case ROUTINE: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case STAT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case URGENT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + default: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; + } + } + + static public org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) { + if (src == null) + return null; + switch(src) { + case ASAP: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ASAP; + case ROUTINE: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ROUTINE; + case STAT: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.STAT; + case URGENT: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.URGENT; + default: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; + case ONHOLD: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; + case REVOKED: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.CANCELLED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.REVOKED; + case COMPLETED: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ENTEREDINERROR; + case SUSPENDED: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ONHOLD; + case UNKNOWN: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Provenance30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Provenance30_40.java new file mode 100644 index 000000000..5e4c8fd3a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Provenance30_40.java @@ -0,0 +1,180 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Type; +import org.hl7.fhir.r4.model.UriType; + +public class Provenance30_40 { + + public static org.hl7.fhir.r4.model.CodeableConcept convertCodingToCodeableConcept(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.getCodingFirstRep().setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.getCodingFirstRep().setVersion(src.getVersion()); + if (src.hasCode()) + tgt.getCodingFirstRep().setCode(src.getCode()); + if (src.hasDisplay()) + tgt.getCodingFirstRep().setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.getCodingFirstRep().setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.r4.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getTarget()) tgt.addTarget(VersionConvertor_30_40.convertReference(t)); + if (src.hasOccurredPeriod()) + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getOccurredPeriod())); + if (src.hasRecorded()) + tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement())); + for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) for (org.hl7.fhir.r4.model.Coding tc : t.getCoding()) tgt.addReason(VersionConvertor_30_40.convertCoding(tc)); + if (src.hasActivity()) + tgt.setActivity(VersionConvertor_30_40.convertCoding(src.getActivity())); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) tgt.addSignature(VersionConvertor_30_40.convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance tgt = new org.hl7.fhir.r4.model.Provenance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) tgt.addTarget(VersionConvertor_30_40.convertReference(t)); + if (src.hasPeriod()) + tgt.setOccurred(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + if (src.hasRecorded()) + tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) tgt.addReason(convertCodingToCodeableConcept(t)); + if (src.hasActivity()) + tgt.setActivity(convertCodingToCodeableConcept(src.getActivity())); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) tgt.addSignature(VersionConvertor_30_40.convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(VersionConvertor_30_40.convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(VersionConvertor_30_40.convertType(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasWho()) { + Type t = VersionConvertor_30_40.convertType(src.getWho()); + if (t instanceof Reference) + tgt.setWho((Reference) t); + if (t instanceof UriType) + tgt.getWho().setReference(t.primitiveValue()); + } + if (src.hasOnBehalfOf()) { + Type t = VersionConvertor_30_40.convertType(src.getOnBehalfOf()); + if (t instanceof Reference) + tgt.setOnBehalfOf((Reference) t); + if (t instanceof UriType) + tgt.getOnBehalfOf().setReference(t.primitiveValue()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) + tgt.setWhat(VersionConvertor_30_40.convertType(src.getWhat())); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) { + Type t = VersionConvertor_30_40.convertType(src.getWhat()); + if (t instanceof Reference) + tgt.setWhat((Reference) t); + else if (t instanceof Identifier) + tgt.getWhat().setIdentifier((Identifier) t); + else if (t instanceof UriType) + tgt.getWhat().setReference(t.primitiveValue()); + } + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: + return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DERIVATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: + return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Questionnaire30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Questionnaire30_40.java new file mode 100644 index 000000000..3bae2c7f2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Questionnaire30_40.java @@ -0,0 +1,303 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.Questionnaire; + +public class Questionnaire30_40 { + + public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(VersionConvertor_30_40.convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(VersionConvertor_30_40.convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_40.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCoding(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasAnswerValueSet()) + tgt.setOptions(VersionConvertor_30_40.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(VersionConvertor_30_40.convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_40.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasOptions()) + tgt.setAnswerValueSetElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.addInitial().setValue(VersionConvertor_30_40.convertType(src.getInitial())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_30_40.convertExtension(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EXISTS) + tgt.setHasAnswer(src.getAnswerBooleanType().getValue()); + else if (src.hasAnswer()) + tgt.setAnswer(VersionConvertor_30_40.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasHasAnswer()) { + tgt.setOperator(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(VersionConvertor_30_40.convertType(src.getHasAnswerElement())); + } else if (src.hasAnswer()) { + tgt.setOperator(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EQUAL); + tgt.setAnswer(VersionConvertor_30_40.convertType(src.getAnswer())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/QuestionnaireResponse30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/QuestionnaireResponse30_40.java new file mode 100644 index 000000000..c1594d534 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/QuestionnaireResponse30_40.java @@ -0,0 +1,153 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse30_40 { + + public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaireElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getQuestionnaire())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasAuthored()) + tgt.setAuthoredElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addParent(VersionConvertor_30_40.convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaire(VersionConvertor_30_40.convertCanonicalToReference(src.getQuestionnaireElement())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasAuthored()) + tgt.setAuthoredElement(VersionConvertor_30_40.convertDateTime(src.getAuthoredElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_40.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_40.convertReference(src.getSource())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: + return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RelatedPerson30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RelatedPerson30_40.java new file mode 100644 index 000000000..69c12fa5c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RelatedPerson30_40.java @@ -0,0 +1,94 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class RelatedPerson30_40 { + + public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r4.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + if (src.hasActive()) { + tgt.setActive(src.getActive()); + } + if (src.hasPatient()) { + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + } + List relationships = src.getRelationship(); + if (relationships.size() > 0) { + tgt.setRelationship(VersionConvertor_30_40.convertCodeableConcept(relationships.get(0))); + if (relationships.size() > 1) { + } + } + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) { + tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + } + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) { + tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + } + if (src.hasGender()) { + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + } + if (src.hasBirthDate()) { + tgt.setBirthDate(tgt.getBirthDate()); + } + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) { + tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + } + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) { + tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + } + return tgt; + } + + public static org.hl7.fhir.r4.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RelatedPerson tgt = new org.hl7.fhir.r4.model.RelatedPerson(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + } + if (src.hasActive()) { + tgt.setActive(src.getActive()); + } + if (src.hasPatient()) { + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + } + if (src.hasRelationship()) { + tgt.addRelationship(VersionConvertor_30_40.convertCodeableConcept(src.getRelationship())); + } + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { + tgt.addName(VersionConvertor_30_40.convertHumanName(t)); + } + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { + tgt.addTelecom(VersionConvertor_30_40.convertContactPoint(t)); + } + if (src.hasGender()) { + tgt.setGender(VersionConvertor_30_40.convertAdministrativeGender(src.getGender())); + } + if (src.hasBirthDate()) { + tgt.setBirthDate(tgt.getBirthDate()); + } + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { + tgt.addAddress(VersionConvertor_30_40.convertAddress(t)); + } + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { + tgt.addPhoto(VersionConvertor_30_40.convertAttachment(t)); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod())); + } + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RiskAssessment30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RiskAssessment30_40.java new file mode 100644 index 000000000..a0a851837 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/RiskAssessment30_40.java @@ -0,0 +1,180 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class RiskAssessment30_40 { + + public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasBasedOn()) + tgt.setBasedOn(VersionConvertor_30_40.convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(VersionConvertor_30_40.convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_40.convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(VersionConvertor_30_40.convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + if (src.hasReasonCode()) + tgt.setReason(VersionConvertor_30_40.convertType(src.getReasonCodeFirstRep())); + if (src.hasReasonReference()) + tgt.setReason(VersionConvertor_30_40.convertType(src.getReasonReferenceFirstRep())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasBasedOn()) + tgt.setBasedOn(VersionConvertor_30_40.convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(VersionConvertor_30_40.convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getContext())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(VersionConvertor_30_40.convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + if (src.hasReason()) { + org.hl7.fhir.r4.model.Type t = VersionConvertor_30_40.convertType(src.getReason()); + if (t instanceof org.hl7.fhir.r4.model.CodeableConcept) + tgt.addReasonCode((org.hl7.fhir.r4.model.CodeableConcept) t); + else + tgt.addReasonReference((org.hl7.fhir.r4.model.Reference) t); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(VersionConvertor_30_40.convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(VersionConvertor_30_40.convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(VersionConvertor_30_40.convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_40.convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(VersionConvertor_30_40.convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(VersionConvertor_30_40.convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(VersionConvertor_30_40.convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: + return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Schedule30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Schedule30_40.java new file mode 100644 index 000000000..57228a86d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Schedule30_40.java @@ -0,0 +1,47 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Schedule30_40 { + + public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getActor()) tgt.addActor(VersionConvertor_30_40.convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(VersionConvertor_30_40.convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) tgt.addActor(VersionConvertor_30_40.convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(VersionConvertor_30_40.convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SearchParameter30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SearchParameter30_40.java new file mode 100644 index 000000000..94a236482 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SearchParameter30_40.java @@ -0,0 +1,275 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter30_40 { + + static public org.hl7.fhir.r4.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQ: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EQ; + case NE: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NE; + case GT: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GT; + case LT: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LT; + case GE: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GE; + case LE: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LE; + case SA: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.SA; + case EB: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EB; + case AP: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.AP; + default: + return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r4.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQ: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EQ; + case NE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NE; + case GT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GT; + case LT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LT; + case GE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GE; + case LE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LE; + case SA: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.SA; + case EB: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EB; + case AP: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.AP; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MISSING: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TEXT; + case IN: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TYPE; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NULL; + } + } + + static public org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MISSING: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TEXT; + case IN: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TYPE; + default: + return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getComparator()) VersionConvertor_30_40.copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); + for (org.hl7.fhir.r4.model.Enumeration t : src.getModifier()) VersionConvertor_30_40.copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); + for (org.hl7.fhir.r4.model.StringType t : src.getChain()) tgt.addChain(t.getValue()); + for (org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getComparator()) VersionConvertor_30_40.copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getModifier()) VersionConvertor_30_40.copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); + for (org.hl7.fhir.dstu3.model.StringType t : src.getChain()) tgt.addChain(t.getValue()); + for (org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_40.convertCanonicalToReference(src.getDefinitionElement())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getDefinition())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + static public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Sequence30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Sequence30_40.java new file mode 100644 index 000000000..fa08ce82a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Sequence30_40.java @@ -0,0 +1,367 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Sequence30_40 { + + static public org.hl7.fhir.dstu3.model.Sequence.QualityType convertQualityType(org.hl7.fhir.r4.model.MolecularSequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INDEL: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL; + case SNP: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL; + } + } + + static public org.hl7.fhir.r4.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.dstu3.model.Sequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INDEL: + return org.hl7.fhir.r4.model.MolecularSequence.QualityType.INDEL; + case SNP: + return org.hl7.fhir.r4.model.MolecularSequence.QualityType.SNP; + case UNKNOWN: + return org.hl7.fhir.r4.model.MolecularSequence.QualityType.UNKNOWN; + default: + return org.hl7.fhir.r4.model.MolecularSequence.QualityType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Sequence.RepositoryType convertRepositoryType(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DIRECTLINK: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK; + case OPENAPI: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI; + case LOGIN: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN; + case OAUTH: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH; + case OTHER: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER; + default: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL; + } + } + + static public org.hl7.fhir.r4.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.dstu3.model.Sequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DIRECTLINK: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.DIRECTLINK; + case OPENAPI: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OPENAPI; + case LOGIN: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.LOGIN; + case OAUTH: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OAUTH; + case OTHER: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OTHER; + default: + return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r4.model.MolecularSequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_40.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPointer()) tgt.addPointer(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence tgt = new org.hl7.fhir.r4.model.MolecularSequence(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_40.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_40.convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_40.convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant()) tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality()) tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository()) tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) tgt.addPointer(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(VersionConvertor_30_40.convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(VersionConvertor_30_40.convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(VersionConvertor_30_40.convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(VersionConvertor_30_40.convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(VersionConvertor_30_40.convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(VersionConvertor_30_40.convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(VersionConvertor_30_40.convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(VersionConvertor_30_40.convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(VersionConvertor_30_40.convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(VersionConvertor_30_40.convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Sequence.SequenceType convertSequenceType(org.hl7.fhir.r4.model.MolecularSequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA; + case DNA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA; + case RNA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA; + default: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL; + } + } + + static public org.hl7.fhir.r4.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.dstu3.model.Sequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AA: + return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.AA; + case DNA: + return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.DNA; + case RNA: + return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.RNA; + default: + return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.NULL; + } + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(VersionConvertor_30_40.convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(VersionConvertor_30_40.convertReference(src.getVariantPointer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Slot30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Slot30_40.java new file mode 100644 index 000000000..1acfda048 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Slot30_40.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Slot30_40 { + + public static org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_40.convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(VersionConvertor_30_40.convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_40.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_40.convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_40.convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(VersionConvertor_30_40.convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Slot.SlotStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Specimen30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Specimen30_40.java new file mode 100644 index 000000000..e0bceb48a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Specimen30_40.java @@ -0,0 +1,197 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Specimen30_40 { + + public static org.hl7.fhir.r4.model.Specimen convertSpecimen(org.hl7.fhir.dstu3.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen tgt = new org.hl7.fhir.r4.model.Specimen(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(VersionConvertor_30_40.convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTimeElement(VersionConvertor_30_40.convertDateTime(src.getReceivedTimeElement())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.addParent(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) tgt.addRequest(VersionConvertor_30_40.convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen convertSpecimen(org.hl7.fhir.r4.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen tgt = new org.hl7.fhir.dstu3.model.Specimen(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(VersionConvertor_30_40.convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTimeElement(VersionConvertor_30_40.convertDateTime(src.getReceivedTimeElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getParent()) tgt.addParent(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRequest()) tgt.addRequest(VersionConvertor_30_40.convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent t : src.getContainer()) tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_40.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(VersionConvertor_30_40.convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(VersionConvertor_30_40.convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(VersionConvertor_30_40.convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(VersionConvertor_30_40.convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_40.convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_40.convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(VersionConvertor_30_40.convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(VersionConvertor_30_40.convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(VersionConvertor_30_40.convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(VersionConvertor_30_40.convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(VersionConvertor_30_40.convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) tgt.addAdditive(VersionConvertor_30_40.convertReference(t)); + if (src.hasTime()) + tgt.setTime(VersionConvertor_30_40.convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(VersionConvertor_30_40.convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.r4.model.Reference t : src.getAdditive()) tgt.addAdditive(VersionConvertor_30_40.convertReference(t)); + if (src.hasTime()) + tgt.setTime(VersionConvertor_30_40.convertType(src.getTime())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r4.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AVAILABLE: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.NULL; + } + } + + static public org.hl7.fhir.r4.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AVAILABLE: + return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: + return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: + return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureDefinition30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureDefinition30_40.java new file mode 100644 index 000000000..c9b982cc0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureDefinition30_40.java @@ -0,0 +1,298 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +public class StructureDefinition30_40 { + + static public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource300(tn)) { + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addKeyword(VersionConvertor_30_40.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addKeyword(VersionConvertor_30_40.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) { + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) { + for (org.hl7.fhir.r4.model.ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_40.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_40.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_40.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_40.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public boolean isResource300(String tn) { + return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription"); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureMap30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureMap30_40.java new file mode 100644 index 000000000..2d2b748ea --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/StructureMap30_40.java @@ -0,0 +1,629 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class StructureMap30_40 { + + public static org.hl7.fhir.dstu3.model.StructureMap convertStructureMap(org.hl7.fhir.r4.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap tgt = new org.hl7.fhir.dstu3.model.StructureMap(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap convertStructureMap(org.hl7.fhir.dstu3.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap tgt = new org.hl7.fhir.r4.model.StructureMap(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r4.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getVariable()) tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.StringType t : src.getVariable()) tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(VersionConvertor_30_40.convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(VersionConvertor_30_40.convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getListMode()) VersionConvertor_30_40.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getListMode()) VersionConvertor_30_40.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NONE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: + return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: + return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NONE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.PRODUCED; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.PRODUCED; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + static public org.hl7.fhir.r4.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CREATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CREATE; + case COPY: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CAST; + case APPEND: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.UUID; + case POINTER: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CC; + case C: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.C; + case QTY: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.QTY; + case ID: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ID; + case CP: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CP; + default: + return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r4.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CREATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CREATE; + case COPY: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CAST; + case APPEND: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.UUID; + case POINTER: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CC; + case C: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.C; + case QTY: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.QTY; + case ID: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ID; + case CP: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CP; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Subscription30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Subscription30_40.java new file mode 100644 index 000000000..ed7a45fe7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Subscription30_40.java @@ -0,0 +1,151 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Subscription30_40 { + + public static org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasReason()) + tgt.setReason(src.getReason()); + if (src.hasCriteria()) + tgt.setCriteria(src.getCriteria()); + if (src.hasError()) + tgt.setError(src.getError()); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasReason()) + tgt.setReason(src.getReason()); + if (src.hasCriteria()) + tgt.setCriteria(src.getCriteria()); + if (src.hasError()) + tgt.setError(src.getError()); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + if (src.hasPayload()) + tgt.setPayload(src.getPayload()); + for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + if (src.hasPayload()) + tgt.setPayload(src.getPayload()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESTHOOK: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; + default: + return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; + } + } + + static public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUESTED: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; + default: + return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Substance30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Substance30_40.java new file mode 100644 index 000000000..fd87c8794 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Substance30_40.java @@ -0,0 +1,125 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class Substance30_40 { + + static public org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_40.convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_40.convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiryElement(VersionConvertor_30_40.convertDateTime(src.getExpiryElement())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiryElement(VersionConvertor_30_40.convertDateTime(src.getExpiryElement())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SupplyDelivery30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SupplyDelivery30_40.java new file mode 100644 index 000000000..076c5399c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/SupplyDelivery30_40.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyDelivery30_40 { + + public static org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(VersionConvertor_30_40.convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifierFirstRep())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_40.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_40.convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_40.convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(VersionConvertor_30_40.convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_40.convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_40.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_40.convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_40.convertType(src.getItem())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestReport30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestReport30_40.java new file mode 100644 index 000000000..06b110beb --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestReport30_40.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestReport30_40 { + + public static org.hl7.fhir.r4.model.TestReport convertTestReport(org.hl7.fhir.dstu3.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport tgt = new org.hl7.fhir.r4.model.TestReport(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(VersionConvertor_30_40.convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertDateTime(src.getIssuedElement())); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent t : src.getTest()) tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport convertTestReport(org.hl7.fhir.r4.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport tgt = new org.hl7.fhir.dstu3.model.TestReport(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(VersionConvertor_30_40.convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssuedElement(VersionConvertor_30_40.convertDateTime(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestReport.TestReportTestComponent t : src.getTest()) tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TESTENGINE: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.SERVER; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.NULL; + } + } + + static public org.hl7.fhir.r4.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TESTENGINE: + return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: + return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: + return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.SERVER; + default: + return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.NULL; + } + } + + static public org.hl7.fhir.r4.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.dstu3.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.r4.model.TestReport.TestReportResult.PASS; + case FAIL: + return org.hl7.fhir.r4.model.TestReport.TestReportResult.FAIL; + case PENDING: + return org.hl7.fhir.r4.model.TestReport.TestReportResult.PENDING; + default: + return org.hl7.fhir.r4.model.TestReport.TestReportResult.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r4.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PASS; + case FAIL: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.FAIL; + case PENDING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PENDING; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestReport.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertSetupActionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r4.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.dstu3.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.WAITING; + case STOPPED: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r4.model.TestReport.TestReportStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r4.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.WAITING; + case STOPPED: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestReport.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r4.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.TestReport.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestReport.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTestActionComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestScript30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestScript30_40.java new file mode 100644 index 000000000..803f0c935 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/TestScript30_40.java @@ -0,0 +1,371 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestScript30_40 { + + public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_30_40.convertReference(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_40.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilitiesElement(VersionConvertor_30_40.convertReferenceToCanonical(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r4.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilities(VersionConvertor_30_40.convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_40.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_40.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ValueSet30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ValueSet30_40.java new file mode 100644 index 000000000..90916ed3c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/ValueSet30_40.java @@ -0,0 +1,336 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r4.model.BooleanType; + +public class ValueSet30_40 { + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_40.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_40.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getValueSet()) tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getValueSet()) tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(VersionConvertor_30_40.convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(VersionConvertor_30_40.convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + 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.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); + VersionConvertor_30_40.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_40.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDateElement()) + tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_40.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_40.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_40.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDateElement(VersionConvertor_30_40.convertDate(src.getLockedDateElement())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDateElement(VersionConvertor_30_40.convertDate(src.getLockedDateElement())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestampElement(VersionConvertor_30_40.convertDateTime(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestampElement(VersionConvertor_30_40.convertDateTime(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_30_40.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_40.convertType(src.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java new file mode 100644 index 000000000..1ad23685a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java @@ -0,0 +1,335 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class ActivityDefinition30_50 { + + public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_50.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(VersionConvertor_30_50.convertReferenceToCanonical(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_50.convertDosage(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransformElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) tgt.addLibrary(VersionConvertor_30_50.convertCanonicalToReference(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_50.convertDosage(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransform(VersionConvertor_30_50.convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + static public org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPOINTMENT: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.APPOINTMENT; + case APPOINTMENTRESPONSE: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.APPOINTMENTRESPONSE; + case CAREPLAN: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CAREPLAN; + case CLAIM: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CLAIM; + case COMMUNICATIONREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.COMMUNICATIONREQUEST; + case CONTRACT: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.CONTRACT; + case DEVICEREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.DEVICEREQUEST; + case ENROLLMENTREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.MEDICATIONREQUEST; + case NUTRITIONORDER: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.NUTRITIONORDER; + case PROCEDUREREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SERVICEREQUEST; + case REFERRALREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SERVICEREQUEST; + case SUPPLYREQUEST: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.SUPPLYREQUEST; + case TASK: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.TASK; + case VISIONPRESCRIPTION: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.VISIONPRESCRIPTION; + default: + return org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPOINTMENT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case SERVICEREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST; + case SUPPLYREQUEST: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionParticipantType convertActivityParticipantType(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java new file mode 100644 index 000000000..d1ea16962 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java @@ -0,0 +1,293 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class AllergyIntolerance30_50 { + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getCategory()) VersionConvertor_30_50.copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_50.convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_50.convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrence(src.getLastOccurrence()); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getCategory()) VersionConvertor_30_50.copyElement(t, tgt.addCategoryElement().setValue(convertAllergyIntoleranceCategory(t.getValue()))); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + if (src.hasAssertedDate()) + tgt.setRecordedDate(src.getAssertedDate()); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_50.convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_50.convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrence(src.getLastOccurrence()); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FOOD: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FOOD: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); + case INACTIVE: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); + case RESOLVED: + new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LOW: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } + } + + static public org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LOW: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_50.convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnset(src.getOnset()); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(VersionConvertor_30_50.convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_50.convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnset(src.getOnset()); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(VersionConvertor_30_50.convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MILD: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MILD: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ALLERGY: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } + } + + static public org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ALLERGY: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: + return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case UNCONFIRMED: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); + case CONFIRMED: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); + case REFUTED: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); + case ENTEREDINERROR: + return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); + default: + return null; + } + } + + static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java new file mode 100644 index 000000000..206d1a34e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java @@ -0,0 +1,230 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Appointment30_50 { + + public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_50.convertCodeableConcept(src.getAppointmentType())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addIndication(VersionConvertor_30_50.convertReference(t.getReference())); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_30_50.convertReference(t)); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.r5.model.Period t : src.getRequestedPeriod()) tgt.addRequestedPeriod(VersionConvertor_30_50.convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_50.convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) tgt.addSlot(VersionConvertor_30_50.convertReference(t)); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) tgt.addRequestedPeriod(VersionConvertor_30_50.convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + } + } + + static public org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REQUIRED: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: + return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AppointmentResponse30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AppointmentResponse30_50.java new file mode 100644 index 000000000..d18d3b1c2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AppointmentResponse30_50.java @@ -0,0 +1,85 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class AppointmentResponse30_50 { + + public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_50.convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_50.convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.Enumerations.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: + return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ParticipationStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACCEPTED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.ACCEPTED; + case DECLINED: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.DECLINED; + case TENTATIVE: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.TENTATIVE; + case NEEDSACTION: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NEEDSACTION; + default: + return org.hl7.fhir.r5.model.Enumerations.ParticipationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AuditEvent30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AuditEvent30_50.java new file mode 100644 index 000000000..5198e744f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AuditEvent30_50.java @@ -0,0 +1,347 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class AuditEvent30_50 { + + public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCoding(src.getType())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_50.convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCoding(src.getType())); + for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_50.convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case C: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + case R: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + case U: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + case D: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + case E: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + } + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasReference()) + tgt.setWho(VersionConvertor_30_50.convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getUserId())); + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(VersionConvertor_30_50.convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(VersionConvertor_30_50.convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(VersionConvertor_30_50.convertReference(src.getWho())); + } + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(VersionConvertor_30_50.convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _1: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(VersionConvertor_30_50.convertReference(src.getReference())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(VersionConvertor_30_50.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_50.convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(VersionConvertor_30_50.convertReference(src.getWhat())); + } + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(VersionConvertor_30_50.convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_50.convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + static public org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case _0: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; + case _4: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; + case _8: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; + case _12: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; + default: + return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCoding(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Basic30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Basic30_50.java new file mode 100644 index 000000000..d0f1c13e1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Basic30_50.java @@ -0,0 +1,41 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Basic30_50 { + + public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Binary30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Binary30_50.java new file mode 100644 index 000000000..61d45446f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Binary30_50.java @@ -0,0 +1,35 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Binary30_50 { + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + VersionConvertor_30_50.copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(VersionConvertor_30_50.convertReference(src.getSecurityContext())); + if (src.hasContent()) + tgt.setData(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + VersionConvertor_30_50.copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(VersionConvertor_30_50.convertReference(src.getSecurityContext())); + if (src.hasData()) + tgt.setContent(src.getData()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/BodySite30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/BodySite30_50.java new file mode 100644 index 000000000..6d32372f9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/BodySite30_50.java @@ -0,0 +1,39 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class BodySite30_50 { + + public static org.hl7.fhir.r5.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) tgt.addImage(VersionConvertor_30_50.convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) tgt.addImage(VersionConvertor_30_50.convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java new file mode 100644 index 000000000..5dbda2446 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java @@ -0,0 +1,323 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Bundle30_50 { + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + VersionConvertor_30_50.copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_30_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + VersionConvertor_30_50.copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(VersionConvertor_30_50.convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DOCUMENT: + return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: + return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: + return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: + return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: + return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: + return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: + return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GET: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: + return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MATCH: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: + return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50.java new file mode 100644 index 000000000..22e6c3d4a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50.java @@ -0,0 +1,872 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class CapabilityStatement30_50 { + + public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + 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())); + 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", VersionConvertor_30_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()) tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + VersionConvertor_30_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown", "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + 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())); + 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()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(VersionConvertor_30_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())) { + tgt.addProfile(VersionConvertor_30_50.convertReference((org.hl7.fhir.r5.model.Reference) ext.getValue())); + } + } + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE; + case CAPABILITY: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS; + default: + return org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + tgt.addEvent(event); + event.setCode(VersionConvertor_30_50.convertCoding((org.hl7.fhir.r5.model.Coding) e.getExtensionByUrl("code").getValue())); + if (e.hasExtension("category")) + event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); + event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); + org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus"); + if (focusE.getValue().hasPrimitiveValue()) + event.setFocus(focusE.getValue().toString()); + else { + event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType()); + VersionConvertor_30_50.copyElement(focusE.getValue(), event.getFocusElement()); + } + event.setRequest(VersionConvertor_30_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("request").getValue())); + event.setResponse(VersionConvertor_30_50.convertReference((org.hl7.fhir.r5.model.Reference) e.getExtensionByUrl("response").getValue())); + if (e.hasExtension("documentation")) + event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) { + org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); + e.addExtension(new org.hl7.fhir.r5.model.Extension("code", VersionConvertor_30_50.convertCoding(t.getCode()))); + if (t.hasCategory()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode()))); + if (t.getFocusElement().hasValue()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus()))); + else { + org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType(); + org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus); + VersionConvertor_30_50.copyElement(t.getFocusElement(), focus); + e.addExtension(focusE); + } + e.addExtension(new org.hl7.fhir.r5.model.Extension("request", VersionConvertor_30_50.convertReference(t.getRequest()))); + e.addExtension(new org.hl7.fhir.r5.model.Extension("response", VersionConvertor_30_50.convertReference(t.getResponse()))); + if (t.hasDocumentation()) + e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation()))); + tgt.addExtension(e); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(VersionConvertor_30_50.convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(VersionConvertor_30_50.convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_50.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_50.convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCanonicalToReference(src.getProfileElement())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getReferencePolicy()) VersionConvertor_30_50.copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getProfile())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getReferencePolicy()) VersionConvertor_30_50.copyElement(t, tgt.addReferencePolicyElement().setValue(convertReferenceHandlingPolicy(t.getValue()))); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) tgt.addService(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRODUCER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SENDER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LITERAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LITERAL: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOVERSION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CLIENT: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.CLIENT; + case SERVER: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.SERVER; + default: + return org.hl7.fhir.r5.model.Enumerations.RestfulCapabilityMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TRANSACTION: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case READ: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: + return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java new file mode 100644 index 000000000..ab58ab240 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java @@ -0,0 +1,439 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +import java.util.List; + +public class CarePlan30_50 { + + private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category"; + + public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + } + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + } + List authors = src.getAuthor(); + if (authors.size() > 0) { + tgt.setAuthor(VersionConvertor_30_50.convertReference(authors.get(0))); + if (authors.size() > 1) { + } + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) { + tgt.addCareTeam(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) { + tgt.addAddresses(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { + tgt.addActivity(convertCarePlanActivityComponent(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) { + tgt.addReplaces(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) { + tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + } + if (src.hasIntent()) { + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + } + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) { + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasSubject()) { + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + } + if (src.hasAuthor()) { + tgt.addAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) { + tgt.addCareTeam(VersionConvertor_30_50.convertReference(t)); + } + for (CodeableReference t : src.getAddresses()) { + if (t.hasReference()) + tgt.addAddresses(VersionConvertor_30_50.convertReference(t.getReference())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) { + tgt.addSupportingInfo(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { + tgt.addActivity(convertCarePlanActivityComponent(t)); + } + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) { + tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (CodeableReference t : src.getOutcome()) { + if (t.hasConcept()) + tgt.addOutcomeCodeableConcept(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + } + for (CodeableReference t : src.getOutcome()) { + if (t.hasReference()) + tgt.addOutcomeReference(VersionConvertor_30_50.convertReference(t.getReference())); + } + for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) { + tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t)); + } + if (src.hasReference()) { + tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference())); + } + if (src.hasDetail()) { + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { + tgt.addOutcome(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) { + tgt.addOutcome(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + } + for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) { + tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t)); + } + if (src.hasReference()) { + tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference())); + } + if (src.hasDetail()) { + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasExtension()) { + org.hl7.fhir.r5.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension); + if (extension != null) { + org.hl7.fhir.r5.model.DataType value = extension.getValue(); + if (value instanceof org.hl7.fhir.r5.model.CodeableConcept) { + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) value)); + } + } + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + } + for (CodeableReference t : src.getReason()) { + if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + } + for (CodeableReference t : src.getReason()) { + if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + } + if (src.hasStatusReason()) { + List coding = src.getStatusReason().getCoding(); + if (coding.size() > 0) { + tgt.setStatusReason(coding.get(0).getCode()); + } + } + if (src.hasDoNotPerform()) { + tgt.setProhibited(src.getDoNotPerform()); + } + if (src.hasScheduled()) { + tgt.setScheduled(VersionConvertor_30_50.convertType(src.getScheduled())); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) { + tgt.addPerformer(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasProduct()) { + tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct())); + } + if (src.hasDailyAmount()) { + tgt.setDailyAmount(VersionConvertor_30_50.convertSimpleQuantity(src.getDailyAmount())); + } + if (src.hasQuantity()) { + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCategory()) { + org.hl7.fhir.r5.model.Extension t = new org.hl7.fhir.r5.model.Extension(); + t.setUrl(CarePlanActivityDetailComponentExtension); + t.setValue(VersionConvertor_30_50.convertType(src.getCategory())); + tgt.addExtension(t); + } + if (src.hasCode()) { + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { + tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { + tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { + tgt.addGoal(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasStatus()) { + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + } + if (src.hasStatusReason()) { + org.hl7.fhir.r5.model.Coding code = new org.hl7.fhir.r5.model.Coding(); + code.setCode(src.getStatusReason()); + org.hl7.fhir.r5.model.CodeableConcept t = new org.hl7.fhir.r5.model.CodeableConcept(code); + tgt.setStatusReason(t); + } + if (src.hasProhibited()) { + tgt.setDoNotPerform(src.getProhibited()); + } + if (src.hasScheduled()) { + tgt.setScheduled(VersionConvertor_30_50.convertType(src.getScheduled())); + } + if (src.hasLocation()) { + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) { + tgt.addPerformer(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasProduct()) { + tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct())); + } + if (src.hasDailyAmount()) { + tgt.setDailyAmount(VersionConvertor_30_50.convertSimpleQuantity(src.getDailyAmount())); + } + if (src.hasQuantity()) { + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + return tgt; + } + + static public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) { + if (src == null) + return null; + switch(src) { + case CANCELLED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case NOTSTARTED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case ONHOLD: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case SCHEDULED: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case UNKNOWN: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) { + if (src == null) + return null; + switch(src) { + case CANCELLED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case NOTSTARTED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case SCHEDULED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPTION: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.OPTION; + case ORDER: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.ORDER; + case PLAN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PROPOSAL; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.NULL; + } + } + + static public org.hl7.fhir.r5.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPTION: + return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.OPTION; + case ORDER: + return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.ORDER; + case PLAN: + return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PLAN; + case PROPOSAL: + return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PROPOSAL; + default: + return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.Enumerations.RequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; + case REVOKED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ENTEREDINERROR; + case ONHOLD: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.SUSPENDED; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.RequestStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED; + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR; + case SUSPENDED: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CareTeam30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CareTeam30_50.java new file mode 100644 index 000000000..fa8b0c4fe --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CareTeam30_50.java @@ -0,0 +1,126 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class CareTeam30_50 { + + public static org.hl7.fhir.r5.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam tgt = new org.hl7.fhir.r5.model.CareTeam(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) tgt.addManagingOrganization(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) tgt.addManagingOrganization(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + if (src.hasMember()) + tgt.setMember(VersionConvertor_30_50.convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(VersionConvertor_30_50.convertReference(src.getOnBehalfOf())); + if (src.hasCoveragePeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getCoveragePeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + if (src.hasMember()) + tgt.setMember(VersionConvertor_30_50.convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(VersionConvertor_30_50.convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setCoverage(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ClinicalImpression30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ClinicalImpression30_50.java new file mode 100644 index 000000000..60234f939 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ClinicalImpression30_50.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class ClinicalImpression30_50 { + + public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPerformer()) + tgt.setAssessor(VersionConvertor_30_50.convertReference(src.getPerformer())); + if (src.hasPrevious()) + tgt.setPrevious(VersionConvertor_30_50.convertReference(src.getPrevious())); + for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getProtocol()) tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPrognosisCodeableConcept()) tgt.addPrognosisCodeableConcept(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPrognosisReference()) tgt.addPrognosisReference(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAssessor()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(VersionConvertor_30_50.convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) tgt.addProblem(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProtocol()) tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPrognosisCodeableConcept()) tgt.addPrognosisCodeableConcept(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPrognosisReference()) tgt.addPrognosisReference(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasItem() && src.getItem().hasConcept()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem().getConcept())); + else if (src.hasItem() && src.getItem().hasReference()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem().getReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItem(VersionConvertor_30_50.convertCodeableConceptToCodableReference(src.getItemCodeableConcept())); + if (src.hasItemReference()) + tgt.setItem(VersionConvertor_30_50.convertReferenceToCodableReference(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + case COMPLETED: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.EventStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CodeSystem30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CodeSystem30_50.java new file mode 100644 index 000000000..c95daaeae --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CodeSystem30_50.java @@ -0,0 +1,369 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class CodeSystem30_50 { + + public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NOTPRESENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getOperator()) VersionConvertor_30_50.copyElement(t, tgt.addOperatorElement().setValue(VersionConvertor_30_50.convertFilterOperator(t.getValue()))); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getOperator()) VersionConvertor_30_50.copyElement(t, tgt.addOperatorElement().setValue(VersionConvertor_30_50.convertFilterOperator(t.getValue()))); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUPEDBY: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } + } + + static public org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUPEDBY: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: + return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_50.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_50.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; + } + } + + static public org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODE: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; + case CODING: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; + case STRING: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; + case INTEGER: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; + default: + return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Communication30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Communication30_50.java new file mode 100644 index 000000000..c06befd26 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Communication30_50.java @@ -0,0 +1,147 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Communication30_50 { + + public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + if (src.getStatus() == org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE) + tgt.setNotDone(true); + else + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setNotDoneReason(VersionConvertor_30_50.convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_30_50.convertReference(t)); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasSent()) + tgt.setSent(src.getSent()); + if (src.hasReceived()) + tgt.setReceived(src.getReceived()); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_50.convertReference(src.getSender())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiatesCanonical(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasNotDone()) + tgt.setStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE); + else if (src.hasStatus()) + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setStatusReason(VersionConvertor_30_50.convertCodeableConcept(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) tgt.addRecipient(VersionConvertor_30_50.convertReference(t)); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasSent()) + tgt.setSent(src.getSent()); + if (src.hasReceived()) + tgt.setReceived(src.getReceived()); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_50.convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(VersionConvertor_30_50.convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(VersionConvertor_30_50.convertType(src.getContent())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Enumerations.EventStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + case ONHOLD: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.EventStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PREPARATION: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.PREPARATION; + case INPROGRESS: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.INPROGRESS; + case SUSPENDED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.ONHOLD; + case ABORTED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.STOPPED; + case COMPLETED: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.EventStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CompartmentDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CompartmentDefinition30_50.java new file mode 100644 index 000000000..00fc6a667 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CompartmentDefinition30_50.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class CompartmentDefinition30_50 { + + public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.StringType t : src.getParam()) tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; + default: + return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; + default: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Composition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Composition30_50.java new file mode 100644 index 000000000..45912a308 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Composition30_50.java @@ -0,0 +1,333 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Composition30_50 { + + public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_30_50.convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(VersionConvertor_30_50.convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSONAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; + default: + return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasParty()) + tgt.setParty(VersionConvertor_30_50.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasParty()) + tgt.setParty(VersionConvertor_30_50.convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertType(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertType(src.getTarget())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case U: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.U; + case L: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.L; + case M: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.M; + case N: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.N; + case R: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.R; + case V: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.V; + default: + return org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r5.model.Composition.V3ConfidentialityClassification src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case U: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U; + case L: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L; + case M: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M; + case N: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N; + case R: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R; + case V: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V; + default: + return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(VersionConvertor_30_50.convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_30_50.convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_50.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(VersionConvertor_30_50.convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) tgt.addEntry(VersionConvertor_30_50.convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_50.convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES; + default: + return org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ListMode convertSectionMode(org.hl7.fhir.dstu3.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; + default: + return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java new file mode 100644 index 000000000..9a94d4ff0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java @@ -0,0 +1,341 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class ConceptMap30_50 { + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertType(src.getSource())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) { + org.hl7.fhir.r5.model.DataType t = VersionConvertor_30_50.convertType(src.getSource()); + tgt.setSource(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } + if (src.hasTarget()) { + org.hl7.fhir.r5.model.DataType t = VersionConvertor_30_50.convertType(src.getTarget()); + tgt.setTarget(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RELATEDTO: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case BROADER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case NARROWER: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case NOTRELATEDTO: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: + return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + static public org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVIDED: + return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: + return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: + return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: + return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROVIDED: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: + return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RELATEDTO: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; + case EQUIVALENT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case EQUAL: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT; + case WIDER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case SUBSUMES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.BROADER; + case NARROWER: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case SPECIALIZES: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NARROWER; + case INEXACT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO; + case UNMATCHED: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + case DISJOINT: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO; + default: + return org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL; + } + } + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setValue(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setCode(src.getValue()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasNoMap() && src.getNoMap() == true) { + tgt.addTarget(new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); + } else { + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) if (t.getEquivalence() == org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { + tgt.setNoMap(true); + } else { + tgt.addTarget(convertTargetElementComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasEquivalence()) + tgt.setRelationship(convertConceptMapRelationship(src.getEquivalence())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasRelationship()) + tgt.setEquivalence(convertConceptMapEquivalence(src.getRelationship())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Condition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Condition30_50.java new file mode 100644 index 000000000..8127651d4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Condition30_50.java @@ -0,0 +1,209 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Condition30_50 { + + private static final String CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL = "http://hl7.org/fhir/condition-ver-status"; + + private static final String CODE_SYSTEM_CONDITION_VER_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-ver-status"; + + private static final String CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL = "http://hl7.org/fhir/condition-clinical"; + + private static final String CODE_SYSTEM_CONDITION_CLINICAL_URL = "http://terminology.hl7.org/CodeSystem/condition-clinical"; + + public static org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(VersionConvertor_30_50.convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(VersionConvertor_30_50.convertType(src.getAbatement())); + if (src.hasAssertedDate()) + tgt.setRecordedDate(src.getAssertedDate()); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_50.convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(VersionConvertor_30_50.convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(VersionConvertor_30_50.convertType(src.getAbatement())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasAsserter()) + tgt.setAsserter(VersionConvertor_30_50.convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "active") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "active")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.ACTIVE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "recurrence") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "recurrence")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RECURRENCE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "inactive") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "inactive")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.INACTIVE; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "remission") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "remission")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.REMISSION; + if (src.hasCoding(CODE_SYSTEM_CONDITION_CLINICAL_URL, "resolved") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_CLINICAL_URL, "resolved")) + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.NULL; + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch(src) { + case ACTIVE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("active"); + return cc; + case RECURRENCE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("recurrence"); + return cc; + case INACTIVE: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("inactive"); + return cc; + case REMISSION: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("remission"); + return cc; + case RESOLVED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_CLINICAL_URL).setCode("resolved"); + return cc; + default: + return null; + } + } + + public static org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(VersionConvertor_30_50.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(VersionConvertor_30_50.convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) tgt.addAssessment(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "provisional") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "provisional")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "differential") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "differential")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "confirmed") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "confirmed")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "refuted") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "refuted")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL, "entered-in-error") || src.hasCoding(CODE_SYSTEM_LEGACY_CONDITION_VER_CLINICAL_URL, "entered-in-error")) + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + } + + static public org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch(src) { + case PROVISIONAL: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem(CODE_SYSTEM_CONDITION_VER_CLINICAL_URL).setCode("entered-in-error"); + return cc; + default: + return null; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Consent30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Consent30_50.java new file mode 100644 index 000000000..8d4bc4a89 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Consent30_50.java @@ -0,0 +1,20 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.exceptions.FHIRException; + +public class Consent30_50 { + + public static org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r5.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent(); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent tgt = new org.hl7.fhir.r5.model.Consent(); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DataElement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DataElement30_50.java new file mode 100644 index 000000000..c0e92411a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DataElement30_50.java @@ -0,0 +1,60 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DataElement30_50 { + + public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.getSnapshot().addElement(VersionConvertor_30_50.convertElementDefinition(t)); + tgt.setKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DetectedIssue30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DetectedIssue30_50.java new file mode 100644 index 000000000..db87e65f9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DetectedIssue30_50.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DetectedIssue30_50 { + + public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(VersionConvertor_30_50.convertDateTime(src.getIdentifiedDateTimeType())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_30_50.convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setIdentified(VersionConvertor_30_50.convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_30_50.convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(VersionConvertor_30_50.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(VersionConvertor_30_50.convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case HIGH: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: + return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java new file mode 100644 index 000000000..41b2d692b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java @@ -0,0 +1,101 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class DeviceUseStatement30_50 { + + public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOn(src.getRecordedOn()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addIndication(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOn(src.getRecordedOn()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: + return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: + return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DiagnosticReport30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DiagnosticReport30_50.java new file mode 100644 index 000000000..aaa4b93c6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DiagnosticReport30_50.java @@ -0,0 +1,153 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DiagnosticReport30_50 { + + public static org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) tgt.addMedia(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) tgt.addConclusionCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_30_50.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) tgt.addSpecimen(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResult()) tgt.addResult(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) tgt.addImagingStudy(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) tgt.addImage(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) tgt.addCodedDiagnosis(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) tgt.addPresentedForm(VersionConvertor_30_50.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(VersionConvertor_30_50.convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(VersionConvertor_30_50.convertReference(src.getLink())); + return tgt; + } + + static public org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DocumentReference30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DocumentReference30_50.java new file mode 100644 index 000000000..0862a30f2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DocumentReference30_50.java @@ -0,0 +1,265 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class DocumentReference30_50 { + + public static org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(VersionConvertor_30_50.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setDate(src.getCreated()); + if (src.hasAuthenticator()) + tgt.setAuthenticator(VersionConvertor_30_50.convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(VersionConvertor_30_50.convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setCreated(src.getDate()); + if (src.hasAuthenticator()) + tgt.setAuthenticator(VersionConvertor_30_50.convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(VersionConvertor_30_50.convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(VersionConvertor_30_50.convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(VersionConvertor_30_50.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(VersionConvertor_30_50.convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(VersionConvertor_30_50.convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(VersionConvertor_30_50.convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(VersionConvertor_30_50.convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(VersionConvertor_30_50.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasEncounter()) + tgt.addEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) tgt.addEvent(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(VersionConvertor_30_50.convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(VersionConvertor_30_50.convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(VersionConvertor_30_50.convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Reference tgt = VersionConvertor_30_50.convertReference(src.getRef()); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + tgt.setRef(VersionConvertor_30_50.convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType2(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType2(org.hl7.fhir.r5.model.Enumerations.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACES: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: + return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r5.model.Enumerations.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.CompositionStatus convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Encounter30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Encounter30_50.java new file mode 100644 index 000000000..8303af7c5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Encounter30_50.java @@ -0,0 +1,317 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Encounter30_50 { + + public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_50.convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_50.convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_50.convertCoding(src.getClass_())); + for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.addAppointment(VersionConvertor_30_50.convertReference(src.getAppointment())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(VersionConvertor_30_50.convertDuration(src.getLength())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_50.convertDiagnosisComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_50.convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(VersionConvertor_30_50.convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(VersionConvertor_30_50.convertCoding(src.getClass_())); + for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.setAppointment(VersionConvertor_30_50.convertReference(src.getAppointmentFirstRep())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(VersionConvertor_30_50.convertDuration(src.getLength())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_50.convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_50.convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(VersionConvertor_30_50.convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(VersionConvertor_30_50.convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(VersionConvertor_30_50.convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(VersionConvertor_30_50.convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(VersionConvertor_30_50.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(VersionConvertor_30_50.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(VersionConvertor_30_50.convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(VersionConvertor_30_50.convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(VersionConvertor_30_50.convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(VersionConvertor_30_50.convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) tgt.addDietPreference(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) tgt.addSpecialCourtesy(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) tgt.addSpecialArrangement(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(VersionConvertor_30_50.convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(VersionConvertor_30_50.convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(VersionConvertor_30_50.convertReference(src.getIndividual())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case TRIAGED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case INPROGRESS: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case FINISHED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED; + case CANCELLED: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Endpoint30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Endpoint30_50.java new file mode 100644 index 000000000..6dc92d146 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Endpoint30_50.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Endpoint30_50 { + + public static org.hl7.fhir.dstu3.model.Endpoint convertEndpoint(org.hl7.fhir.r5.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Endpoint tgt = new org.hl7.fhir.dstu3.model.Endpoint(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(VersionConvertor_30_50.convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPayloadType()) tgt.addPayloadType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getPayloadMimeType()) tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Endpoint convertEndpoint(org.hl7.fhir.dstu3.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Endpoint tgt = new org.hl7.fhir.r5.model.Endpoint(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(VersionConvertor_30_50.convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPayloadType()) tgt.addPayloadType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getPayloadMimeType()) tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) tgt.addHeader(t.getValue()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ERROR; + case OFF: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.TEST; + default: + return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r5.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ERROR; + case OFF: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.TEST; + default: + return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/EpisodeOfCare30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/EpisodeOfCare30_50.java new file mode 100644 index 000000000..22ebfe0a4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/EpisodeOfCare30_50.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class EpisodeOfCare30_50 { + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_50.convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_30_50.convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(VersionConvertor_30_50.convertReference(src.getCareManager())); + for (org.hl7.fhir.r5.model.Reference t : src.getTeam()) tgt.addTeam(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(VersionConvertor_30_50.convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) tgt.addReferralRequest(VersionConvertor_30_50.convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(VersionConvertor_30_50.convertReference(src.getCareManager())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTeam()) tgt.addTeam(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) tgt.addAccount(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PLANNED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ExpansionProfile30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ExpansionProfile30_50.java new file mode 100644 index 000000000..afa53bc27 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ExpansionProfile30_50.java @@ -0,0 +1,112 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; +import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; +import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.DataType; + +public class ExpansionProfile30_50 { + + public static org.hl7.fhir.dstu3.model.ExpansionProfile convertExpansionProfile(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile(); + if (src.hasParameter("profile-url")) + tgt.setUrl(src.getParameter("profile-url").primitiveValue()); + if (src.hasParameter("profile-version")) + tgt.setVersion(src.getParameter("profile-version").primitiveValue()); + if (src.hasParameter("profile-name")) + tgt.setName(src.getParameter("profile-name").primitiveValue()); + if (src.hasParameter("profile-status")) + tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue())); + for (DataType t : src.getParameters("system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT); + } + for (DataType t : src.getParameters("force-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE); + } + for (DataType t : src.getParameters("check-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK); + } + for (DataType t : src.getParameters("exclude-system")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]); + } + if (src.hasParameter("includeDesignations")) + tgt.setIncludeDesignations(src.getParameterBool("")); + for (DataType t : src.getParameters("designation")) { + String[] v = t.primitiveValue().split("\\|"); + if ("urn:ietf:bcp:47".equals(v[0])) + tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]); + else + tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]); + } + if (src.hasParameter("includeDefinition")) + tgt.setIncludeDefinition(src.getParameterBool("includeDefinition")); + if (src.hasParameter("activeOnly")) + tgt.setActiveOnly(src.getParameterBool("activeOnly")); + if (src.hasParameter("excludeNested")) + tgt.setExcludeNested(src.getParameterBool("excludeNested")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("displayLanguage")) + tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue()); + if (src.hasParameter("limitedExpansion")) + tgt.setLimitedExpansion(src.getParameterBool("getParameterBool")); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters convertExpansionProfile(org.hl7.fhir.dstu3.model.ExpansionProfile src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + if (src.hasUrl()) + tgt.addParameter("profile-url", src.getUrl()); + if (src.hasVersion()) + tgt.addParameter("profile-version", src.getVersion()); + if (src.hasName()) + tgt.addParameter("profile-name", src.getName()); + if (src.hasStatus()) + tgt.addParameter("profile-status", src.getStatus().toCode()); + for (org.hl7.fhir.dstu3.model.ExpansionProfile.ExpansionProfileFixedVersionComponent t : src.getFixedVersion()) { + if (t.getMode() == SystemVersionProcessingMode.DEFAULT) + tgt.addParameter("system-version", t.getSystem() + "|" + t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.CHECK) + tgt.addParameter("check-system-version", t.getSystem() + "|" + t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.OVERRIDE) + tgt.addParameter("force-system-version", t.getSystem() + "|" + t.getVersion()); + } + if (src.hasExcludedSystem()) { + tgt.addParameter("exclude-system", src.getExcludedSystem().getSystem() + "|" + src.getExcludedSystem().getVersion()); + } + if (src.hasIncludeDesignations()) + tgt.addParameter("includeDesignations", src.getIncludeDesignations()); + for (DesignationIncludeDesignationComponent t : src.getDesignation().getInclude().getDesignation()) { + if (t.hasLanguage()) + tgt.addParameter("designation", "urn:ietf:bcp:47|" + t.getLanguage()); + if (t.hasUse()) + tgt.addParameter("designation", t.getUse().getSystem() + "|" + t.getUse().getCode()); + } + if (src.hasIncludeDefinition()) + tgt.addParameter("includeDefinition", src.getIncludeDefinition()); + if (src.hasActiveOnly()) + tgt.addParameter("activeOnly", src.getActiveOnly()); + if (src.hasExcludeNested()) + tgt.addParameter("excludeNested", src.getExcludeNested()); + if (src.hasExcludeNotForUI()) + tgt.addParameter("excludeNotForUI", src.getExcludeNotForUI()); + if (src.hasExcludePostCoordinated()) + tgt.addParameter("excludePostCoordinated", src.getExcludePostCoordinated()); + if (src.hasDisplayLanguage()) + tgt.addParameter("excludePostCoordinated", src.getDisplayLanguage()); + if (src.hasLimitedExpansion()) + tgt.addParameter("limitedExpansion", src.getLimitedExpansion()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/FamilyMemberHistory30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/FamilyMemberHistory30_50.java new file mode 100644 index 000000000..3f6481288 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/FamilyMemberHistory30_50.java @@ -0,0 +1,142 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class FamilyMemberHistory30_50 { + + static public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PARTIAL: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: + return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasDataAbsentReason()) + tgt.setNotDoneReason(VersionConvertor_30_50.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(VersionConvertor_30_50.convertCodeableConcept(src.getRelationship())); + if (src.hasBorn()) + tgt.setBorn(VersionConvertor_30_50.convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_50.convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_50.convertType(src.getDeceased())); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiatesCanonical(t.getReference()); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setDataAbsentReason(VersionConvertor_30_50.convertCodeableConcept(src.getNotDoneReason())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(VersionConvertor_30_50.convertCodeableConcept(src.getRelationship())); + if (src.hasBorn()) + tgt.setBorn(VersionConvertor_30_50.convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_50.convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_50.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(VersionConvertor_30_50.convertType(src.getOnset())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Flag30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Flag30_50.java new file mode 100644 index 000000000..08f628269 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Flag30_50.java @@ -0,0 +1,83 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Flag30_50 { + + public static org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java new file mode 100644 index 000000000..a74583398 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java @@ -0,0 +1,164 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Goal30_50 { + + public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r5.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasLifecycleStatus()) + tgt.setStatus(convertGoalStatus(src.getLifecycleStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_50.convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_50.convertType(src.getStart())); + if (src.hasTarget()) + tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep())); + if (src.hasStatusDate()) + tgt.setStatusDate(src.getStatusDate()); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(VersionConvertor_30_50.convertReference(src.getExpressedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (CodeableReference t : src.getOutcome()) if (t.hasConcept()) + tgt.addOutcomeCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getOutcome()) if (t.hasReference()) + tgt.addOutcomeReference(VersionConvertor_30_50.convertReference(t.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal tgt = new org.hl7.fhir.r5.model.Goal(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setLifecycleStatus(convertGoalStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_50.convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_50.convertType(src.getStart())); + if (src.hasTarget()) + tgt.addTarget(convertGoalTargetComponent(src.getTarget())); + if (src.hasStatusDate()) + tgt.setStatusDate(src.getStatusDate()); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(VersionConvertor_30_50.convertReference(src.getExpressedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) tgt.addOutcome(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) tgt.addOutcome(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Goal.GoalStatus convertGoalStatus(org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PROPOSED; + case ACCEPTED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACCEPTED; + case PLANNED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PLANNED; + case ACTIVE: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACHIEVED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ENTEREDINERROR; + case REJECTED: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.REJECTED; + default: + return org.hl7.fhir.dstu3.model.Goal.GoalStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus convertGoalStatus(org.hl7.fhir.dstu3.model.Goal.GoalStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PROPOSED; + case ACCEPTED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACCEPTED; + case PLANNED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PLANNED; + case INPROGRESS: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case ONTARGET: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case AHEADOFTARGET: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case BEHINDTARGET: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case SUSTAINING: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case ACHIEVED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.COMPLETED; + case ONHOLD: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; + case REJECTED: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.REJECTED; + default: + return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r5.model.Goal.GoalTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_50.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_50.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_50.convertType(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r5.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_50.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_50.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_50.convertType(src.getDue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/GraphDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/GraphDefinition30_50.java new file mode 100644 index 000000000..7c2c29381 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/GraphDefinition30_50.java @@ -0,0 +1,245 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class GraphDefinition30_50 { + + static public org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r5.model.Enumerations.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE; + default: + return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.CompartmentType convertCompartmentCode(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT; + case ENCOUNTER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER; + case RELATEDPERSON: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE; + default: + return org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IDENTICAL: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: + return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL; + } + } + + static public org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IDENTICAL: + return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: + return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: + return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: + return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: + return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.NULL; + } + } + + public static org.hl7.fhir.r5.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition tgt = new org.hl7.fhir.r5.model.GraphDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r5.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Group30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Group30_50.java new file mode 100644 index 000000000..f13a3dfb8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Group30_50.java @@ -0,0 +1,155 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Group30_50 { + + public static org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(VersionConvertor_30_50.convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(VersionConvertor_30_50.convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PERSON: + return org.hl7.fhir.r5.model.Group.GroupType.PERSON; + case ANIMAL: + return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; + case DEVICE: + return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; + case MEDICATION: + return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; + case SUBSTANCE: + return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; + default: + return org.hl7.fhir.r5.model.Group.GroupType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/HealthcareService30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/HealthcareService30_50.java new file mode 100644 index 000000000..b70b534d3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/HealthcareService30_50.java @@ -0,0 +1,152 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableConcept; +import org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent; + +public class HealthcareService30_50 { + + public static org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(VersionConvertor_30_50.convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_50.convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_50.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasEligibility() || src.hasEligibilityNote()) { + HealthcareServiceEligibilityComponent t = tgt.addEligibility(); + t.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + t.setComment(src.getEligibilityNote()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(VersionConvertor_30_50.convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_50.convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_50.convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) tgt.addServiceProvisionCode(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasEligibility()) { + tgt.setEligibility(VersionConvertor_30_50.convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + if (src.getEligibilityFirstRep().hasComment()) + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + } + for (CodeableConcept t : src.getProgram()) tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) tgt.addCharacteristic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) tgt.addReferralMethod(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_50.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_50.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_50.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_50.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImagingStudy30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImagingStudy30_50.java new file mode 100644 index 000000000..914b1592f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImagingStudy30_50.java @@ -0,0 +1,297 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyProcedureComponent; + +import java.util.List; + +public class ImagingStudy30_50 { + + private static final String URN_DICOM_UID = "urn:dicom:uid"; + + private static final String URN_IETF_RFC_3986 = "urn:ietf:rfc:3986"; + + public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r5.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { + if (URN_DICOM_UID.equals(t.getSystem())) { + tgt.setUid(t.getValue()); + } else { + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + } + } + if (src.hasStatus()) { + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus s = src.getStatus(); + switch(s) { + case REGISTERED: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE); + break; + case AVAILABLE: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE); + break; + case CANCELLED: + tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); + break; + default: + break; + } + } + for (org.hl7.fhir.r5.model.Coding t : src.getModality()) { + tgt.addModalityList(VersionConvertor_30_50.convertCoding(t)); + } + if (src.hasSubject()) { + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getSubject())); + } + if (src.hasEncounter()) { + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_50.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasReferrer()) { + tgt.setReferrer(VersionConvertor_30_50.convertReference(src.getReferrer())); + } + for (org.hl7.fhir.r5.model.Reference t : src.getInterpreter()) { + tgt.addInterpreter(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasNumberOfSeries()) { + tgt.setNumberOfSeries(src.getNumberOfSeries()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + for (ImagingStudyProcedureComponent t : src.getProcedure()) { + if (t.hasValueReference()) { + tgt.addProcedureReference(VersionConvertor_30_50.convertReference(t.getValueReference())); + } else { + tgt.addProcedureCode(VersionConvertor_30_50.convertCodeableConcept(t.getValueCodeableConcept())); + } + } + List reasonCodes = src.getReason(); + if (reasonCodes.size() > 0) { + tgt.setReason(VersionConvertor_30_50.convertCodeableConcept(reasonCodes.get(0).getConcept())); + if (reasonCodes.size() > 1) { + } + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { + tgt.addSeries(convertImagingStudySeriesComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy tgt = new org.hl7.fhir.r5.model.ImagingStudy(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUid()) { + org.hl7.fhir.r5.model.Identifier i = new org.hl7.fhir.r5.model.Identifier(); + i.setSystem(URN_DICOM_UID); + i.setValue(src.getUid()); + tgt.addIdentifier(i); + } + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + } + if (src.hasAccession()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getAccession())); + if (src.hasAvailability()) { + org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability availability = src.getAvailability(); + switch(availability) { + case OFFLINE: + tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.REGISTERED); + break; + case UNAVAILABLE: + tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.CANCELLED); + break; + case ONLINE: + case NEARLINE: + tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.AVAILABLE); + break; + default: + break; + } + } else { + tgt.setStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.UNKNOWN); + } + for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) { + tgt.addModality(VersionConvertor_30_50.convertCoding(t)); + } + if (src.hasPatient()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasContext()) { + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_50.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { + tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasReferrer()) { + tgt.setReferrer(VersionConvertor_30_50.convertReference(src.getReferrer())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) { + tgt.addInterpreter(VersionConvertor_30_50.convertReference(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasNumberOfSeries()) { + tgt.setNumberOfSeries(src.getNumberOfSeries()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + List procedureReferences = src.getProcedureReference(); + if (procedureReferences.size() > 0) { + tgt.addProcedure().setValue(VersionConvertor_30_50.convertReference(procedureReferences.get(0))); + } + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProcedureCode()) { + tgt.addProcedure().setValue(VersionConvertor_30_50.convertCodeableConcept(t)); + } + if (src.hasReason()) { + tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(src.getReason())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) { + tgt.addSeries(convertImagingStudySeriesComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasModality()) { + tgt.setModality(VersionConvertor_30_50.convertCoding(src.getModality())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_50.convertCoding(src.getBodySite())); + } + if (src.hasLaterality()) { + tgt.setLaterality(VersionConvertor_30_50.convertCoding(src.getLaterality())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_50.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasModality()) { + tgt.setModality(VersionConvertor_30_50.convertCoding(src.getModality())); + } + if (src.hasDescription()) { + tgt.setDescription(src.getDescription()); + } + if (src.hasNumberOfInstances()) { + tgt.setNumberOfInstances(src.getNumberOfInstances()); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) { + tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + } + if (src.hasBodySite()) { + tgt.setBodySite(VersionConvertor_30_50.convertCoding(src.getBodySite())); + } + if (src.hasLaterality()) { + tgt.setLaterality(VersionConvertor_30_50.convertCoding(src.getLaterality())); + } + if (src.hasStarted()) { + tgt.setStartedElement(VersionConvertor_30_50.convertDateTime(src.getStartedElement())); + } + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) { + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + org.hl7.fhir.r5.model.Coding sop = src.getSopClass(); + if (URN_IETF_RFC_3986.equals(sop.getSystem())) { + tgt.setSopClass(sop.getCode()); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + return tgt; + } + + static public org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUid()) { + tgt.setUid(src.getUid()); + } + if (src.hasSopClass()) { + org.hl7.fhir.r5.model.Coding c = new org.hl7.fhir.r5.model.Coding(); + c.setSystem(URN_IETF_RFC_3986); + c.setCode(src.getSopClass()); + tgt.setSopClass(c); + } + if (src.hasNumber()) { + tgt.setNumber(src.getNumber()); + } + if (src.hasTitle()) { + tgt.setTitle(src.getTitle()); + } + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Immunization30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Immunization30_50.java new file mode 100644 index 000000000..14567cf85 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Immunization30_50.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class Immunization30_50 { + + public static org.hl7.fhir.r5.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization tgt = new org.hl7.fhir.r5.model.Immunization(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(VersionConvertor_30_50.convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setOccurrence(VersionConvertor_30_50.convertDateTime(src.getDateElement())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasReportOrigin()) + tgt.setInformationSource(VersionConvertor_30_50.convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_50.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_50.convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent t : src.getPractitioner()) tgt.addPerformer(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(VersionConvertor_30_50.convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasOccurrenceDateTimeType()) + tgt.setDateElement(VersionConvertor_30_50.convertDateTime(src.getOccurrenceDateTimeType())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasInformationSourceCodeableConcept()) + tgt.setReportOrigin(VersionConvertor_30_50.convertCodeableConcept(src.getInformationSourceCodeableConcept())); + if (src.hasLocation()) + tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_50.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_50.convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) tgt.addPractitioner(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.getExplanation().addReason(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasFunction()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRole()) + tgt.setFunction(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes convertImmunizationStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Immunization.ImmunizationStatusCodes.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImplementationGuide30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImplementationGuide30_50.java new file mode 100644 index 000000000..2ad03b927 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ImplementationGuide30_50.java @@ -0,0 +1,280 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Enumeration; + +import java.util.List; + +public class ImplementationGuide30_50 { + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + break; + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) { + findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.getDefinition().hasPage()) + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.hasPage()) + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasPackageId()) + tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION, new org.hl7.fhir.dstu3.model.IdType(src.getPackageId()))); + if (src.hasVersion()) + tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION, new org.hl7.fhir.dstu3.model.StringType(src.getVersion()))); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (org.hl7.fhir.dstu3.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { + tgt.setPackageId(org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); + } + if (org.hl7.fhir.dstu3.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { + tgt.setVersion(org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + tgt.setId(src.getId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p" + (context.getGrouping().size() + 1)); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(VersionConvertor_30_50.convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasExampleFor()) { + org.hl7.fhir.r5.model.DataType t = VersionConvertor_30_50.convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(VersionConvertor_30_50.convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration convertPageGeneration(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind kind) { + switch(kind) { + case PAGE: + return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.HTML; + default: + return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.GENERATED; + } + } + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertPageGeneration(org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration generation) { + switch(generation) { + case HTML: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + default: + return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + } + } + + public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + VersionConvertor_30_50.copyElement(src, tgt); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) if (t.hasId() && t.getId().equals(id)) + return t; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t1.setName("Default Package"); + t1.setId(id); + return t1; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Library30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Library30_50.java new file mode 100644 index 000000000..6b00e6aea --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Library30_50.java @@ -0,0 +1,140 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class Library30_50 { + + public static org.hl7.fhir.dstu3.model.Library convertLibrary(org.hl7.fhir.r5.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Library tgt = new org.hl7.fhir.dstu3.model.Library(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(VersionConvertor_30_50.convertParameterDefinition(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getContent()) tgt.addContent(VersionConvertor_30_50.convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_50.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(VersionConvertor_30_50.convertParameterDefinition(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) tgt.addContent(VersionConvertor_30_50.convertAttachment(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Linkage30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Linkage30_50.java new file mode 100644 index 000000000..0467ca5aa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Linkage30_50.java @@ -0,0 +1,87 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Linkage30_50 { + + public static org.hl7.fhir.r5.model.Linkage convertLinkage(org.hl7.fhir.dstu3.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage tgt = new org.hl7.fhir.r5.model.Linkage(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent t : src.getItem()) tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage convertLinkage(org.hl7.fhir.r5.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage tgt = new org.hl7.fhir.dstu3.model.Linkage(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Linkage.LinkageItemComponent t : src.getItem()) tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r5.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r5.model.Linkage.LinkageItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertReference(src.getResource())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.dstu3.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r5.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: + return org.hl7.fhir.r5.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: + return org.hl7.fhir.r5.model.Linkage.LinkageType.HISTORICAL; + default: + return org.hl7.fhir.r5.model.Linkage.LinkageType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r5.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.HISTORICAL; + default: + return org.hl7.fhir.dstu3.model.Linkage.LinkageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/List30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/List30_50.java new file mode 100644 index 000000000..e4290cba0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/List30_50.java @@ -0,0 +1,161 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class List30_50 { + + public static org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_50.convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(VersionConvertor_30_50.convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(VersionConvertor_30_50.convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent convertListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(VersionConvertor_30_50.convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(VersionConvertor_30_50.convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertReference(src.getItem())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES; + default: + return org.hl7.fhir.r5.model.Enumerations.ListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.r5.model.Enumerations.ListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case WORKING: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + case SNAPSHOT: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CURRENT: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + case RETIRED: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Location30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Location30_50.java new file mode 100644 index 000000000..1c7cc6917 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Location30_50.java @@ -0,0 +1,159 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Location30_50 { + + public static org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(VersionConvertor_30_50.convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.addType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(VersionConvertor_30_50.convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(VersionConvertor_30_50.convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(VersionConvertor_30_50.convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INSTANCE: + return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; + case KIND: + return org.hl7.fhir.r5.model.Location.LocationMode.KIND; + default: + return org.hl7.fhir.r5.model.Location.LocationMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: + return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: + return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; + default: + return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Measure30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Measure30_50.java new file mode 100644 index 000000000..6f1c07803 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Measure30_50.java @@ -0,0 +1,290 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class Measure30_50 { + + public static org.hl7.fhir.r5.model.Measure convertMeasure(org.hl7.fhir.dstu3.model.Measure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure tgt = new org.hl7.fhir.r5.model.Measure(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + for (org.hl7.fhir.dstu3.model.CodeableConcept concept : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(concept)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + if (t.hasContact()) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_50.convertContactDetail(c)); + else + tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); + if (t.getType() == ContributorType.EDITOR) + if (t.hasContact()) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); + else + tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); + if (t.getType() == ContributorType.REVIEWER) + if (t.hasContact()) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); + else + tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); + if (t.getType() == ContributorType.ENDORSER) + if (t.hasContact()) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_50.convertContactDetail(c).setName(t.hasName() ? t.getName() : null)); + else + tgt.addAuthor(new org.hl7.fhir.r5.model.ContactDetail().setName(t.getName())); + } + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference r : src.getLibrary()) tgt.addLibrary(r.getReference()); + if (src.hasDisclaimer()) + tgt.setDisclaimer(src.getDisclaimer()); + if (src.hasScoring()) + tgt.setScoring(VersionConvertor_30_50.convertCodeableConcept(src.getScoring())); + if (src.hasCompositeScoring()) + tgt.setCompositeScoring(VersionConvertor_30_50.convertCodeableConcept(src.getCompositeScoring())); + if (src.hasRiskAdjustment()) + tgt.setRiskAdjustment(src.getRiskAdjustment()); + if (src.hasRateAggregation()) + tgt.setRateAggregation(src.getRateAggregation()); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + if (src.hasClinicalRecommendationStatement()) + tgt.setClinicalRecommendationStatement(src.getClinicalRecommendationStatement()); + if (src.hasImprovementNotation()) { + if (src.getImprovementNotation().toLowerCase().contains("increase") || src.getImprovementNotation().toLowerCase().contains("higher")) + tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("increase").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation())); + else if (src.getImprovementNotation().toLowerCase().contains("decrease") || src.getImprovementNotation().toLowerCase().contains("lower")) + tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode("decrease").setSystem("http://terminology.hl7.org/CodeSystem/measure-improvement-notation")).setText(src.getImprovementNotation())); + else + tgt.setImprovementNotation(new org.hl7.fhir.r5.model.CodeableConcept().setText(src.getImprovementNotation())); + } + for (org.hl7.fhir.dstu3.model.MarkdownType m : src.getDefinition()) tgt.addDefinition(m.getValue()); + if (src.hasGuidance()) + tgt.setGuidance(src.getGuidance()); + for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent g : src.getGroup()) tgt.addGroup(convertMeasureGroup(g)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Measure convertMeasure(org.hl7.fhir.r5.model.Measure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Measure tgt = new org.hl7.fhir.dstu3.model.Measure(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + for (org.hl7.fhir.r5.model.CodeableConcept concept : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(concept)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + if (src.hasAuthor()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = VersionConvertor_30_50.convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.AUTHOR); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasEditor()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = VersionConvertor_30_50.convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.EDITOR); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasReviewer()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = VersionConvertor_30_50.convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.REVIEWER); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + if (src.hasEndorser()) + for (org.hl7.fhir.r5.model.ContactDetail c : src.getAuthor()) { + ContactDetail cd = VersionConvertor_30_50.convertContactDetail(c); + Contributor con = new Contributor().setType(ContributorType.ENDORSER); + if (cd.hasName()) + con.setName(cd.getName()); + tgt.addContributor(con); + } + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType r : src.getLibrary()) tgt.addLibrary(VersionConvertor_30_50.convertCanonicalToReference(r)); + if (src.hasDisclaimer()) + tgt.setDisclaimer(src.getDisclaimer()); + if (src.hasScoring()) + tgt.setScoring(VersionConvertor_30_50.convertCodeableConcept(src.getScoring())); + if (src.hasCompositeScoring()) + tgt.setCompositeScoring(VersionConvertor_30_50.convertCodeableConcept(src.getCompositeScoring())); + if (src.hasRiskAdjustment()) + tgt.setRiskAdjustment(src.getRiskAdjustment()); + if (src.hasRateAggregation()) + tgt.setRateAggregation(src.getRateAggregation()); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + if (src.hasClinicalRecommendationStatement()) + tgt.setClinicalRecommendationStatement(src.getClinicalRecommendationStatement()); + if (src.hasImprovementNotation()) + for (org.hl7.fhir.r5.model.Coding cc : src.getImprovementNotation().getCoding()) { + if (cc.hasCode() && cc.getCode().equals("increase")) + tgt.setImprovementNotation(cc.getCode()); + else if (cc.hasCode() && cc.getCode().equals("decrease")) + tgt.setImprovementNotation(cc.getCode()); + } + for (org.hl7.fhir.r5.model.MarkdownType m : src.getDefinition()) tgt.addDefinition(m.getValue()); + if (src.hasGuidance()) + tgt.setGuidance(src.getGuidance()); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupComponent g : src.getGroup()) tgt.addGroup(convertMeasureGroup(g)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent convertMeasureGroup(org.hl7.fhir.r5.model.Measure.MeasureGroupComponent src) { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent(); + if (src.hasCode() && src.getCode().hasCoding()) + tgt.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setValue(src.getCode().getCodingFirstRep().getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent p : src.getPopulation()) tgt.addPopulation(convertMeasureGroupPopulation(p)); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent s : src.getStratifier()) tgt.addStratifier(convertMeasureGroupStratifier(s)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupComponent convertMeasureGroup(org.hl7.fhir.dstu3.model.Measure.MeasureGroupComponent src) { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupComponent(); + if (src.hasIdentifier()) + tgt.setCode(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode(src.getIdentifier().getValue()))); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent p : src.getPopulation()) tgt.addPopulation(convertMeasureGroupPopulation(p)); + for (org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent s : src.getStratifier()) tgt.addStratifier(convertMeasureGroupStratifier(s)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulation(org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent src) { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent(); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasCriteria() && src.getCriteria().hasExpression()) + tgt.setCriteria(src.getCriteria().getExpression()); + if (src.hasCriteria() && src.getCriteria().hasName()) { + tgt.setName(src.getCriteria().getName()); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulation(org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent src) { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent(); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasCriteria()) + tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setExpression(src.getCriteria())); + if (src.hasName()) { + if (tgt.hasCriteria()) + tgt.getCriteria().setName(src.getName()); + else + tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setName(src.getName())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifier(org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent src) { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent(); + if (src.hasIdentifier()) + tgt.setCode(new org.hl7.fhir.r5.model.CodeableConcept().addCoding(new org.hl7.fhir.r5.model.Coding().setCode(src.getIdentifier().getValue()))); + if (src.hasCriteria()) + tgt.setCriteria(new org.hl7.fhir.r5.model.Expression().setExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifier(org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent src) { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.dstu3.model.Measure.MeasureGroupStratifierComponent(); + if (src.hasCode() && src.getCode().hasCoding()) + tgt.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setValue(src.getCode().getCodingFirstRep().getCode())); + if (src.hasCriteria() && src.getCriteria().hasExpression()) + tgt.setCriteria(src.getCriteria().getExpression()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Media30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Media30_50.java new file mode 100644 index 000000000..b167e5f70 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Media30_50.java @@ -0,0 +1,23 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Media30_50 { + + public static org.hl7.fhir.r5.model.DocumentReference convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java new file mode 100644 index 000000000..26ee8b301 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java @@ -0,0 +1,127 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Medication30_50 { + + public static org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setDoseForm(VersionConvertor_30_50.convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasPackage()) + tgt.setBatch(convertMedicationPackageBatchComponent(src.getPackage().getBatchFirstRep())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer())); + if (src.hasDoseForm()) + tgt.setForm(VersionConvertor_30_50.convertCodeableConcept(src.getDoseForm())); + for (org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasBatch()) + tgt.getPackage().addBatch(convertMedicationPackageBatchComponent(src.getBatch())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasStrengthRatio()) + tgt.setAmount(VersionConvertor_30_50.convertRatio(src.getStrengthRatio())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasAmount()) + tgt.setStrength(VersionConvertor_30_50.convertRatio(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Medication.MedicationBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationBatchComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Medication.MedicationStatusCodes convertMedicationStatus(org.hl7.fhir.dstu3.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Medication.MedicationStatusCodes.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r5.model.Medication.MedicationStatusCodes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationAdministration30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationAdministration30_50.java new file mode 100644 index 000000000..4c7d3215b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationAdministration30_50.java @@ -0,0 +1,156 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class MedicationAdministration30_50 { + + public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r5.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.addDefinition().setReference(t.getValue()); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertMedicationAdministrationStatus(src.getStatusElement())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasOccurence()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getOccurence())); + for (org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + if (src.hasRequest()) + tgt.setPrescription(VersionConvertor_30_50.convertReference(src.getRequest())); + for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) tgt.addDevice(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.dstu3.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration tgt = new org.hl7.fhir.r5.model.MedicationAdministration(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) tgt.addInstantiatesUri(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertMedicationAdministrationStatus(src.getStatusElement())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasEffective()) + tgt.setOccurence(VersionConvertor_30_50.convertType(src.getEffective())); + for (org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + if (src.hasPrescription()) + tgt.setRequest(VersionConvertor_30_50.convertReference(src.getPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDevice()) tgt.addDevice(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_50.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_50.convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(VersionConvertor_30_50.convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(VersionConvertor_30_50.convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(VersionConvertor_30_50.convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(VersionConvertor_30_50.convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(VersionConvertor_30_50.convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(VersionConvertor_30_50.convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumeration convertMedicationAdministrationStatus(org.hl7.fhir.dstu3.model.Enumeration src) { + if (src == null) + return null; + org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(); + VersionConvertor_30_50.copyElement(src, tgt); + tgt.setValue(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationStatusCodes.fromCode(src.getValueAsString())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertMedicationAdministrationStatus(org.hl7.fhir.r5.model.Enumeration src) { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration(); + VersionConvertor_30_50.copyElement(src, tgt); + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus.fromCode(src.getValueAsString())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationDispense30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationDispense30_50.java new file mode 100644 index 000000000..fb5a557ab --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationDispense30_50.java @@ -0,0 +1,205 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class MedicationDispense30_50 { + + public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_30_50.convertReference(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(VersionConvertor_30_50.convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPrepared(src.getWhenPrepared()); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOver(src.getWhenHandedOver()); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_50.convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) tgt.addAuthorizingPrescription(VersionConvertor_30_50.convertReference(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(VersionConvertor_30_50.convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPrepared(src.getWhenPrepared()); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOver(src.getWhenHandedOver()); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_50.convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(VersionConvertor_30_50.convertReference(src.getActor())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration(); + VersionConvertor_30_50.copyElement(src, tgt); + switch(src.getValue()) { + case PREPARATION: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.PREPARATION); + break; + case INPROGRESS: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); + break; + case ONHOLD: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); + break; + case COMPLETED: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); + break; + case STOPPED: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED); + break; + case DECLINED: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED); + break; + case NULL: + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration(new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodesEnumFactory()); + VersionConvertor_30_50.copyElement(src, tgt); + switch(src.getValue()) { + case PREPARATION: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.PREPARATION); + break; + case INPROGRESS: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.INPROGRESS); + break; + case ONHOLD: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ONHOLD); + break; + case COMPLETED: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ENTEREDINERROR); + break; + case STOPPED: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED); + break; + case NULL: + tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.NULL); + break; + } + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) tgt.setResponsibleParty(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasResponsibleParty()) + tgt.addResponsibleParty(VersionConvertor_30_50.convertReference(src.getResponsibleParty())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationRequest30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationRequest30_50.java new file mode 100644 index 000000000..e86519273 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationRequest30_50.java @@ -0,0 +1,274 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class MedicationRequest30_50 { + + public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(VersionConvertor_30_50.convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOn(src.getAuthoredOn()); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_50.convertReference(src.getRecorder())); + for (CodeableReference t : src.getReason()) { + if (t.hasConcept()) { + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + } + if (t.hasReference()) { + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + } + } + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_50.convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(VersionConvertor_30_50.convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(VersionConvertor_30_50.convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOn(src.getAuthoredOn()); + if (src.hasRecorder()) + tgt.setRecorder(VersionConvertor_30_50.convertReference(src.getRecorder())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(new CodeableReference().setConcept(VersionConvertor_30_50.convertCodeableConcept(t))); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(new CodeableReference().setReference(VersionConvertor_30_50.convertReference(t))); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.addDosageInstruction(VersionConvertor_30_50.convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(VersionConvertor_30_50.convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(VersionConvertor_30_50.convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(VersionConvertor_30_50.convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setDispenser(VersionConvertor_30_50.convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(VersionConvertor_30_50.convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(VersionConvertor_30_50.convertDuration(src.getExpectedSupplyDuration())); + if (src.hasDispenser()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getDispenser())); + return tgt; + } + + static public org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSAL: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PROPOSAL: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.RequestPriority convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT; + case STAT: + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT; + case ASAP: + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP; + default: + return org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r5.model.Enumerations.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ROUTINE: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT; + case STAT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT; + case ASAP: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL; + } + } + + static public org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.STOPPED; + case DRAFT: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.DRAFT; + case UNKNOWN: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAllowed()) + tgt.setAllowed(VersionConvertor_30_50.convertBoolean(src.getAllowedElement())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_50.convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAllowedBooleanType()) + tgt.setAllowedElement(VersionConvertor_30_50.convertBoolean(src.getAllowedBooleanType())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_50.convertCodeableConcept(src.getReason())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java new file mode 100644 index 000000000..cd9593ef6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java @@ -0,0 +1,116 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeableReference; + +public class MedicationStatement30_50 { + + public static org.hl7.fhir.r5.model.MedicationUsage convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationUsage tgt = new org.hl7.fhir.r5.model.MedicationUsage(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasInformationSource()) + tgt.setInformationSource(VersionConvertor_30_50.convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) tgt.addDerivedFrom(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_50.convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationUsage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasMedication()) + tgt.setMedication(VersionConvertor_30_50.convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasInformationSource()) + tgt.setInformationSource(VersionConvertor_30_50.convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) tgt.addDerivedFrom(VersionConvertor_30_50.convertReference(t)); + for (CodeableReference t : src.getReason()) if (t.hasConcept()) + tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept())); + for (CodeableReference t : src.getReason()) if (t.hasReference()) + tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(VersionConvertor_30_50.convertDosage(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + default: + return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE; + case COMPLETED: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR; + case INTENDED: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED; + case STOPPED: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.STOPPED; + case ONHOLD: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ONHOLD; + default: + return org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageDefinition30_50.java new file mode 100644 index 000000000..07ee48fa5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageDefinition30_50.java @@ -0,0 +1,187 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageDefinition30_50 { + + public static org.hl7.fhir.dstu3.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r5.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition tgt = new org.hl7.fhir.dstu3.model.MessageDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_30_50.convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getParent()) tgt.addParent(VersionConvertor_30_50.convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getReplaces()) tgt.addReplaces(VersionConvertor_30_50.convertCanonicalToReference(t)); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_30_50.convertCoding(src.getEventCoding())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() != org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.dstu3.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition tgt = new org.hl7.fhir.r5.model.MessageDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBaseElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.getParent().add(VersionConvertor_30_50.convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) tgt.getReplaces().add(VersionConvertor_30_50.convertReferenceToCanonical(t)); + if (src.hasEvent()) + tgt.setEvent(VersionConvertor_30_50.convertCoding(src.getEvent())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() ? org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS : org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessage(VersionConvertor_30_50.convertCanonicalToReference(src.getMessageElement())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessageElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getMessage())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCanonicalToReference(src.getProfileElement())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfileElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getProfile())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NULL; + } + } + + static public org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CONSEQUENCE: + return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: + return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: + return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: + return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageHeader30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageHeader30_50.java new file mode 100644 index 000000000..612e0ecde --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MessageHeader30_50.java @@ -0,0 +1,181 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class MessageHeader30_50 { + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasEvent()) + tgt.setEvent(VersionConvertor_30_50.convertCoding(src.getEvent())); + for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_50.convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(VersionConvertor_30_50.convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(VersionConvertor_30_50.convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_50.convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) tgt.addFocus(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasEventCoding()) + tgt.setEvent(VersionConvertor_30_50.convertCoding(src.getEventCoding())); + for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(VersionConvertor_30_50.convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(VersionConvertor_30_50.convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(VersionConvertor_30_50.convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(VersionConvertor_30_50.convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) tgt.addFocus(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_50.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_50.convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(VersionConvertor_30_50.convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(VersionConvertor_30_50.convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + static public org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OK: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + default: + return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/NamingSystem30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/NamingSystem30_50.java new file mode 100644 index 000000000..bd2c51b62 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/NamingSystem30_50.java @@ -0,0 +1,167 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class NamingSystem30_50 { + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + static public org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CODESYSTEM: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: + return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Observation30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Observation30_50.java new file mode 100644 index 000000000..8999bb2a0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Observation30_50.java @@ -0,0 +1,229 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Observation30_50 { + + public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_30_50.convertReference(t)); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_50.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(VersionConvertor_30_50.convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_50.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(VersionConvertor_30_50.convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) tgt.addPerformer(VersionConvertor_30_50.convertReference(t)); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_50.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(VersionConvertor_30_50.convertCodeableConcept(src.getInterpretation())); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_50.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(VersionConvertor_30_50.convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(VersionConvertor_30_50.convertReference(t.getTarget())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_50.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(VersionConvertor_30_50.convertCodeableConcept(src.getInterpretation())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(VersionConvertor_30_50.convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(VersionConvertor_30_50.convertCodeableConcept(src.getInterpretationFirstRep())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(VersionConvertor_30_50.convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(VersionConvertor_30_50.convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_50.convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(VersionConvertor_30_50.convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(VersionConvertor_30_50.convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(VersionConvertor_30_50.convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(VersionConvertor_30_50.convertReference(src)); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java new file mode 100644 index 000000000..e20134154 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java @@ -0,0 +1,268 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.DataType; +import org.hl7.fhir.r5.model.Enumerations; + +public class OperationDefinition30_50 { + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBaseElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBase(VersionConvertor_30_50.convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.StringType t : src.getParameterName()) tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParameterName()) tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(VersionConvertor_30_50.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + DataType t = VersionConvertor_30_50.convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(VersionConvertor_30_50.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(Enumerations.FHIRAllTypes.fromCode(src.getType())); + if (src.hasSearchType()) + tgt.setSearchType(VersionConvertor_30_50.convertSearchParamType(src.getSearchType())); + if (src.hasProfile()) + tgt.addTargetProfile(src.getProfile().getReference()); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType().toCode()); + if (src.hasSearchType()) + tgt.setSearchType(VersionConvertor_30_50.convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case OPERATION: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: + return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.OUT; + default: + return org.hl7.fhir.r5.model.Enumerations.OperationParameterUse.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.Enumerations.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case IN: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: + return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationOutcome30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationOutcome30_50.java new file mode 100644 index 000000000..f1752dda4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationOutcome30_50.java @@ -0,0 +1,229 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class OperationOutcome30_50 { + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FATAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } + } + + static public org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: + return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_50.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(VersionConvertor_30_50.convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Organization30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Organization30_50.java new file mode 100644 index 000000000..25a9121f4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Organization30_50.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Organization30_50 { + + public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(VersionConvertor_30_50.convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(VersionConvertor_30_50.convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(VersionConvertor_30_50.convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(VersionConvertor_30_50.convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(VersionConvertor_30_50.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java new file mode 100644 index 000000000..aa60ebe82 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java @@ -0,0 +1,55 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Parameters30_50 { + + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + VersionConvertor_30_50.copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + VersionConvertor_30_50.copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false)); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false)); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Patient30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Patient30_50.java new file mode 100644 index 000000000..6c6d688b1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Patient30_50.java @@ -0,0 +1,224 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Patient30_50 { + + public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(VersionConvertor_30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(VersionConvertor_30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(VersionConvertor_30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", VersionConvertor_30_50.convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", VersionConvertor_30_50.convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", VersionConvertor_30_50.convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(VersionConvertor_30_50.convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_50.convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) tgt.addRelationship(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(VersionConvertor_30_50.convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(VersionConvertor_30_50.convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_50.convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + case REPLACES: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACES; + case REFER: + return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REPLACEDBY: + return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; + case REPLACES: + return org.hl7.fhir.r5.model.Patient.LinkType.REPLACES; + case REFER: + return org.hl7.fhir.r5.model.Patient.LinkType.REFER; + case SEEALSO: + return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; + default: + return org.hl7.fhir.r5.model.Patient.LinkType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_50.convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(VersionConvertor_30_50.convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(VersionConvertor_30_50.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) tgt.addGeneralPractitioner(VersionConvertor_30_50.convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + if (src.hasDeceased()) + tgt.setDeceased(VersionConvertor_30_50.convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(VersionConvertor_30_50.convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(VersionConvertor_30_50.convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) tgt.addGeneralPractitioner(VersionConvertor_30_50.convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(VersionConvertor_30_50.convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(VersionConvertor_30_50.convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(VersionConvertor_30_50.convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(VersionConvertor_30_50.convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PaymentNotice30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PaymentNotice30_50.java new file mode 100644 index 000000000..0d116e0c8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PaymentNotice30_50.java @@ -0,0 +1,91 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class PaymentNotice30_50 { + + public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(VersionConvertor_30_50.convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(VersionConvertor_30_50.convertReference(src.getResponse())); + if (src.hasPaymentDate()) + tgt.setStatusDate(src.getPaymentDate()); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasRecipient()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getRecipient())); + if (src.hasProvider()) + tgt.setProvider(VersionConvertor_30_50.convertReference(src.getProvider())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(VersionConvertor_30_50.convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(VersionConvertor_30_50.convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(VersionConvertor_30_50.convertReference(src.getResponse())); + if (src.hasStatusDate()) + tgt.setPaymentDate(src.getStatusDate()); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasTarget()) + tgt.setRecipient(VersionConvertor_30_50.convertReference(src.getTarget())); + if (src.hasProvider()) + tgt.setProvider(VersionConvertor_30_50.convertReference(src.getProvider())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(VersionConvertor_30_50.convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED; + case DRAFT: + return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Person30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Person30_50.java new file mode 100644 index 000000000..95cfe80c0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Person30_50.java @@ -0,0 +1,111 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Person30_50 { + + static public org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + } + } + + static public org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case LEVEL1: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; + default: + return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_50.convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(VersionConvertor_30_50.convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(VersionConvertor_30_50.convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(VersionConvertor_30_50.convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java new file mode 100644 index 000000000..1e4e3ee11 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java @@ -0,0 +1,683 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.exceptions.FHIRException; + +public class PlanDefinition30_50 { + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SINGLE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SINGLE: + return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: + return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.MULTIPLE; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionConditionKind convertActionConditionKind(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPLICABILITY: + return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.APPLICABILITY; + case START: + return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.START; + case STOP: + return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.STOP; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case APPLICABILITY: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START; + case STOP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VISUALGROUP: + return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: + return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: + return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.SENTENCEGROUP; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case VISUALGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionParticipantType convertActionParticipantType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PATIENT: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case YES: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case YES: + return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.YES; + case NO: + return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NO; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BEFORESTART: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORESTART; + case BEFORE: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORE; + case BEFOREEND: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTERSTART; + case AFTER: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTER; + case AFTEREND: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTEREND; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BEFORESTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MUST: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MUST: + return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUST; + case COULD: + return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: + return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.NULL; + } + } + + static public org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ANY: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ANY; + case ALL: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALL; + case ALLORNONE: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ONEORMORE; + default: + return org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ANY: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: + return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(VersionConvertor_30_50.convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) tgt.addLibrary(VersionConvertor_30_50.convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) tgt.addAuthor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) tgt.addEditor(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) tgt.addReviewer(VersionConvertor_30_50.convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) tgt.addEndorser(VersionConvertor_30_50.convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(VersionConvertor_30_50.convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLabel()) + tgt.setPrefix(src.getLabel()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) tgt.addTrigger(VersionConvertor_30_50.convertTriggerDefinition(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.getType().addCoding(VersionConvertor_30_50.convertCoding(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_50.convertReferenceToCanonical(src.getDefinition())); + if (src.hasTransform()) + tgt.setTransformElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setLabel(src.getPrefix()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) tgt.addTriggerDefinition(VersionConvertor_30_50.convertTriggerDefinition(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_50.convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCoding(src.getType().getCodingFirstRep())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinitionCanonicalType()) + tgt.setDefinition(VersionConvertor_30_50.convertCanonicalToReference(src.getDefinitionCanonicalType())); + if (src.hasTransform()) + tgt.setTransform(VersionConvertor_30_50.convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(src.getLanguage()); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(VersionConvertor_30_50.convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(VersionConvertor_30_50.convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(VersionConvertor_30_50.convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_50.convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_50.convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(VersionConvertor_30_50.convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(VersionConvertor_30_50.convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(VersionConvertor_30_50.convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_50.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_50.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_50.convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(VersionConvertor_30_50.convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(VersionConvertor_30_50.convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(VersionConvertor_30_50.convertDuration(src.getDue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Practitioner30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Practitioner30_50.java new file mode 100644 index 000000000..f3e963ecd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Practitioner30_50.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Practitioner30_50 { + + public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_30_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + if (src.hasGender()) + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) tgt.addCommunication(VersionConvertor_30_50.convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(VersionConvertor_30_50.convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(VersionConvertor_30_50.convertReference(src.getIssuer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PractitionerRole30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PractitionerRole30_50.java new file mode 100644 index 000000000..de9690872 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PractitionerRole30_50.java @@ -0,0 +1,138 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class PractitionerRole30_50 { + + static public org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek convertDaysOfWeek2(org.hl7.fhir.r5.model.Enumerations.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MON: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.MON; + case TUE: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.TUE; + case WED: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.WED; + case THU: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.THU; + case FRI: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SUN; + default: + return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r5.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole tgt = new org.hl7.fhir.dstu3.model.PractitionerRole(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(VersionConvertor_30_50.convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_50.convertReference(src.getOrganization())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) tgt.addHealthcareService(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole tgt = new org.hl7.fhir.r5.model.PractitionerRole(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(VersionConvertor_30_50.convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(VersionConvertor_30_50.convertReference(src.getOrganization())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) tgt.addLocation(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) tgt.addHealthcareService(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek2(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_30_50.copyElement(t, tgt.addDaysOfWeekElement().setValue(VersionConvertor_30_50.convertDaysOfWeek(t.getValue()))); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_50.convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(VersionConvertor_30_50.convertPeriod(src.getDuring())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java new file mode 100644 index 000000000..0c02e44aa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java @@ -0,0 +1,299 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Questionnaire; + +public class Questionnaire30_50 { + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(VersionConvertor_30_50.convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCoding(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasAnswerValueSet()) + tgt.setOptions(VersionConvertor_30_50.convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(VersionConvertor_30_50.convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasOptions()) + tgt.setAnswerValueSetElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.addInitial().setValue(VersionConvertor_30_50.convertType(src.getInitial())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) { + tgt.addModifierExtension(VersionConvertor_30_50.convertExtension(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS) + tgt.setHasAnswer(src.getAnswerBooleanType().getValue()); + else if (src.hasAnswer()) + tgt.setAnswer(VersionConvertor_30_50.convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasHasAnswer()) { + tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(VersionConvertor_30_50.convertType(src.getHasAnswerElement())); + } else if (src.hasAnswer()) { + tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EQUAL); + tgt.setAnswer(VersionConvertor_30_50.convertType(src.getAnswer())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case BOOLEAN: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + static public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case GROUP: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case BOOLEAN: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: + return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/QuestionnaireResponse30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/QuestionnaireResponse30_50.java new file mode 100644 index 000000000..c3e4588db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/QuestionnaireResponse30_50.java @@ -0,0 +1,153 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class QuestionnaireResponse30_50 { + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaireElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getQuestionnaire())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addParent(VersionConvertor_30_50.convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaire(VersionConvertor_30_50.convertCanonicalToReference(src.getQuestionnaireElement())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + if (src.hasAuthor()) + tgt.setAuthor(VersionConvertor_30_50.convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(VersionConvertor_30_50.convertReference(src.getSource())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: + return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: + return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RelatedPerson30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RelatedPerson30_50.java new file mode 100644 index 000000000..ea7e51013 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RelatedPerson30_50.java @@ -0,0 +1,94 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +import java.util.List; + +public class RelatedPerson30_50 { + + public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r5.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + } + if (src.hasActive()) { + tgt.setActive(src.getActive()); + } + if (src.hasPatient()) { + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + } + List relationships = src.getRelationship(); + if (relationships.size() > 0) { + tgt.setRelationship(VersionConvertor_30_50.convertCodeableConcept(relationships.get(0))); + if (relationships.size() > 1) { + } + } + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) { + tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + } + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) { + tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + } + if (src.hasGender()) { + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + } + if (src.hasBirthDate()) { + tgt.setBirthDate(tgt.getBirthDate()); + } + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) { + tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + } + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) { + tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedPerson tgt = new org.hl7.fhir.r5.model.RelatedPerson(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + } + if (src.hasActive()) { + tgt.setActive(src.getActive()); + } + if (src.hasPatient()) { + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + } + if (src.hasRelationship()) { + tgt.addRelationship(VersionConvertor_30_50.convertCodeableConcept(src.getRelationship())); + } + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { + tgt.addName(VersionConvertor_30_50.convertHumanName(t)); + } + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { + tgt.addTelecom(VersionConvertor_30_50.convertContactPoint(t)); + } + if (src.hasGender()) { + tgt.setGender(VersionConvertor_30_50.convertAdministrativeGender(src.getGender())); + } + if (src.hasBirthDate()) { + tgt.setBirthDate(tgt.getBirthDate()); + } + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { + tgt.addAddress(VersionConvertor_30_50.convertAddress(t)); + } + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { + tgt.addPhoto(VersionConvertor_30_50.convertAttachment(t)); + } + if (src.hasPeriod()) { + tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod())); + } + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RiskAssessment30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RiskAssessment30_50.java new file mode 100644 index 000000000..269a48749 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/RiskAssessment30_50.java @@ -0,0 +1,179 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class RiskAssessment30_50 { + + public static org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasBasedOn()) + tgt.setBasedOn(VersionConvertor_30_50.convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(VersionConvertor_30_50.convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_50.convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(VersionConvertor_30_50.convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getPerformer())); + if (src.hasReason()) { + if (src.getReason() instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference((org.hl7.fhir.dstu3.model.CodeableConcept) src.getReason())); + else if (src.getReason() instanceof org.hl7.fhir.dstu3.model.Reference) + tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference((org.hl7.fhir.dstu3.model.Reference) src.getReason())); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasBasedOn()) + tgt.setBasedOn(VersionConvertor_30_50.convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(VersionConvertor_30_50.convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_50.convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(VersionConvertor_30_50.convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getPerformer())); + if (src.hasReason() && src.getReasonFirstRep().hasConcept()) + tgt.setReason(VersionConvertor_30_50.convertType(src.getReasonFirstRep().getConcept())); + if (src.hasReason() && src.getReasonFirstRep().hasReference()) + tgt.setReason(VersionConvertor_30_50.convertType(src.getReasonFirstRep().getReference())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) tgt.addBasis(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(VersionConvertor_30_50.convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(VersionConvertor_30_50.convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(VersionConvertor_30_50.convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(VersionConvertor_30_50.convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(VersionConvertor_30_50.convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(VersionConvertor_30_50.convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(VersionConvertor_30_50.convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + static public org.hl7.fhir.r5.model.Enumerations.ObservationStatus convertRiskAssessmentStatus(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.FINAL; + case AMENDED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.UNKNOWN; + default: + return org.hl7.fhir.r5.model.Enumerations.ObservationStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r5.model.Enumerations.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case REGISTERED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Schedule30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Schedule30_50.java new file mode 100644 index 000000000..652c4c8be --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Schedule30_50.java @@ -0,0 +1,47 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Schedule30_50 { + + public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getActor()) tgt.addActor(VersionConvertor_30_50.convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(VersionConvertor_30_50.convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) tgt.addActor(VersionConvertor_30_50.convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(VersionConvertor_30_50.convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SearchParameter30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SearchParameter30_50.java new file mode 100644 index 000000000..628df2da4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SearchParameter30_50.java @@ -0,0 +1,275 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class SearchParameter30_50 { + + static public org.hl7.fhir.r5.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQ: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EQ; + case NE: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NE; + case GT: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GT; + case LT: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LT; + case GE: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GE; + case LE: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LE; + case SA: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.SA; + case EB: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EB; + case AP: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.AP; + default: + return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r5.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQ: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EQ; + case NE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NE; + case GT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GT; + case LT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LT; + case GE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GE; + case LE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LE; + case SA: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.SA; + case EB: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EB; + case AP: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.AP; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NULL; + } + } + + static public org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MISSING: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TEXT; + case IN: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TYPE; + default: + return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case MISSING: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TEXT; + case IN: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TYPE; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NULL; + } + } + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getComparator()) VersionConvertor_30_50.copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getModifier()) VersionConvertor_30_50.copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); + for (org.hl7.fhir.dstu3.model.StringType t : src.getChain()) tgt.addChain(t.getValue()); + for (org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getComparator()) VersionConvertor_30_50.copyElement(t, tgt.addComparatorElement().setValue(convertSearchComparator(t.getValue()))); + for (org.hl7.fhir.r5.model.Enumeration t : src.getModifier()) VersionConvertor_30_50.copyElement(t, tgt.addModifierElement().setValue(convertSearchModifierCode(t.getValue()))); + for (org.hl7.fhir.r5.model.StringType t : src.getChain()) tgt.addChain(t.getValue()); + for (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinitionElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getDefinition())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinition(VersionConvertor_30_50.convertCanonicalToReference(src.getDefinitionElement())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + static public org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NORMAL: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: + return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Sequence30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Sequence30_50.java new file mode 100644 index 000000000..6adc12db3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Sequence30_50.java @@ -0,0 +1,367 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Sequence30_50 { + + static public org.hl7.fhir.r5.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.dstu3.model.Sequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INDEL: + return org.hl7.fhir.r5.model.MolecularSequence.QualityType.INDEL; + case SNP: + return org.hl7.fhir.r5.model.MolecularSequence.QualityType.SNP; + case UNKNOWN: + return org.hl7.fhir.r5.model.MolecularSequence.QualityType.UNKNOWN; + default: + return org.hl7.fhir.r5.model.MolecularSequence.QualityType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Sequence.QualityType convertQualityType(org.hl7.fhir.r5.model.MolecularSequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INDEL: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL; + case SNP: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP; + case UNKNOWN: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN; + default: + return org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Sequence.RepositoryType convertRepositoryType(org.hl7.fhir.r5.model.MolecularSequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DIRECTLINK: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK; + case OPENAPI: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI; + case LOGIN: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN; + case OAUTH: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH; + case OTHER: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER; + default: + return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL; + } + } + + static public org.hl7.fhir.r5.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.dstu3.model.Sequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case DIRECTLINK: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.DIRECTLINK; + case OPENAPI: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OPENAPI; + case LOGIN: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.LOGIN; + case OAUTH: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OAUTH; + case OTHER: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OTHER; + default: + return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.NULL; + } + } + + public static org.hl7.fhir.r5.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence tgt = new org.hl7.fhir.r5.model.MolecularSequence(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_50.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant()) tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality()) tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository()) tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) tgt.addPointer(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r5.model.MolecularSequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(VersionConvertor_30_50.convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(VersionConvertor_30_50.convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(VersionConvertor_30_50.convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPointer()) tgt.addPointer(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(VersionConvertor_30_50.convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(VersionConvertor_30_50.convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(VersionConvertor_30_50.convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(VersionConvertor_30_50.convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(VersionConvertor_30_50.convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(VersionConvertor_30_50.convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(VersionConvertor_30_50.convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(VersionConvertor_30_50.convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(VersionConvertor_30_50.convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(VersionConvertor_30_50.convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Sequence.SequenceType convertSequenceType(org.hl7.fhir.r5.model.MolecularSequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA; + case DNA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA; + case RNA: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA; + default: + return org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL; + } + } + + static public org.hl7.fhir.r5.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.dstu3.model.Sequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AA: + return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.AA; + case DNA: + return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.DNA; + case RNA: + return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.RNA; + default: + return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(VersionConvertor_30_50.convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(VersionConvertor_30_50.convertReference(src.getVariantPointer())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Slot30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Slot30_50.java new file mode 100644 index 000000000..5c2846688 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Slot30_50.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Slot30_50 { + + public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.addServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_50.convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(VersionConvertor_30_50.convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.setServiceCategory(VersionConvertor_30_50.convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(VersionConvertor_30_50.convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(VersionConvertor_30_50.convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(VersionConvertor_30_50.convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case BUSY: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; + case FREE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: + return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Slot.SlotStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Specimen30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Specimen30_50.java new file mode 100644 index 000000000..fb4563e19 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Specimen30_50.java @@ -0,0 +1,197 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Specimen30_50 { + + public static org.hl7.fhir.dstu3.model.Specimen convertSpecimen(org.hl7.fhir.r5.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen tgt = new org.hl7.fhir.dstu3.model.Specimen(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(VersionConvertor_30_50.convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTime(src.getReceivedTime()); + for (org.hl7.fhir.r5.model.Reference t : src.getParent()) tgt.addParent(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) tgt.addRequest(VersionConvertor_30_50.convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent t : src.getContainer()) tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen convertSpecimen(org.hl7.fhir.dstu3.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen tgt = new org.hl7.fhir.r5.model.Specimen(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(VersionConvertor_30_50.convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTime(src.getReceivedTime()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) tgt.addParent(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) tgt.addRequest(VersionConvertor_30_50.convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(VersionConvertor_30_50.convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(VersionConvertor_30_50.convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(VersionConvertor_30_50.convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(VersionConvertor_30_50.convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(VersionConvertor_30_50.convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(VersionConvertor_30_50.convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(VersionConvertor_30_50.convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(VersionConvertor_30_50.convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(VersionConvertor_30_50.convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(VersionConvertor_30_50.convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(VersionConvertor_30_50.convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) tgt.addAdditive(VersionConvertor_30_50.convertReference(t)); + if (src.hasTime()) + tgt.setTime(VersionConvertor_30_50.convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(VersionConvertor_30_50.convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.r5.model.Reference t : src.getAdditive()) tgt.addAdditive(VersionConvertor_30_50.convertReference(t)); + if (src.hasTime()) + tgt.setTime(VersionConvertor_30_50.convertType(src.getTime())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r5.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AVAILABLE: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case AVAILABLE: + return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: + return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: + return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java new file mode 100644 index 000000000..5c2a08939 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java @@ -0,0 +1,298 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +public class StructureDefinition30_50 { + + static public org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case DATATYPE: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: + return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FHIRPATH: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: + String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; + if (isResource300(tn)) { + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + } else { + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + } + case EXTENSION: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addKeyword(VersionConvertor_30_50.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) { + for (org.hl7.fhir.r5.model.ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addKeyword(VersionConvertor_30_50.convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression())); + tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); + } + for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_50.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_50.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PRIMITIVETYPE: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_50.convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_30_50.convertElementDefinition(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SPECIALIZATION: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: + return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + static public boolean isResource300(String tn) { + return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription"); + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java new file mode 100644 index 000000000..c64831714 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java @@ -0,0 +1,629 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class StructureMap30_50 { + + public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu3.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap tgt = new org.hl7.fhir.dstu3.model.StructureMap(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getImport()) tgt.addImport(t.getValue()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TYPE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getVariable()) tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(VersionConvertor_30_50.convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(VersionConvertor_30_50.convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getListMode()) VersionConvertor_30_50.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getListMode()) VersionConvertor_30_50.copyElement(t, tgt.addListModeElement().setValue(convertStructureMapTargetListMode(t.getValue()))); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NONE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: + return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: + return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case NONE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.TARGET; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case SOURCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.PRODUCED; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case FIRST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CREATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CREATE; + case COPY: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CAST; + case APPEND: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.UUID; + case POINTER: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CC; + case C: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.C; + case QTY: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.QTY; + case ID: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ID; + case CP: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CP; + default: + return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.NULL; + } + } + + static public org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case CREATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; + case COPY: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; + case APPEND: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; + case POINTER: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CC; + case C: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.C; + case QTY: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.QTY; + case ID: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ID; + case CP: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CP; + default: + return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + } + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java new file mode 100644 index 000000000..26a314976 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java @@ -0,0 +1,125 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class Substance30_50 { + + static public org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case ACTIVE: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_50.convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(VersionConvertor_30_50.convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiry(src.getExpiry()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiry(src.getExpiry()); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SupplyDelivery30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SupplyDelivery30_50.java new file mode 100644 index 000000000..5d82421db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/SupplyDelivery30_50.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class SupplyDelivery30_50 { + + public static org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_50.convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(VersionConvertor_30_50.convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(VersionConvertor_30_50.convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(VersionConvertor_30_50.convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(VersionConvertor_30_50.convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(VersionConvertor_30_50.convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(VersionConvertor_30_50.convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(VersionConvertor_30_50.convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) tgt.addReceiver(VersionConvertor_30_50.convertReference(t)); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + static public org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case INPROGRESS: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(VersionConvertor_30_50.convertType(src.getItem())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestReport30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestReport30_50.java new file mode 100644 index 000000000..646a92a14 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestReport30_50.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestReport30_50 { + + public static org.hl7.fhir.dstu3.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport tgt = new org.hl7.fhir.dstu3.model.TestReport(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(VersionConvertor_30_50.convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest()) tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.dstu3.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(VersionConvertor_30_50.convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent t : src.getTest()) tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + static public org.hl7.fhir.r5.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TESTENGINE: + return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: + return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: + return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER; + default: + return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case TESTENGINE: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.SERVER; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.NULL; + } + } + + static public org.hl7.fhir.r5.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.dstu3.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS; + case FAIL: + return org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL; + case PENDING: + return org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING; + default: + return org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r5.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case PASS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PASS; + case FAIL: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.FAIL; + case PENDING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PENDING; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertSetupActionComponent(t)); + return tgt; + } + + static public org.hl7.fhir.r5.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.dstu3.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING; + case STOPPED: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL; + } + } + + static public org.hl7.fhir.dstu3.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r5.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case COMPLETED: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.WAITING; + case STOPPED: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: + return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestReport.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTestActionComponent(t)); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestScript30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestScript30_50.java new file mode 100644 index 000000000..dc777f04f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/TestScript30_50.java @@ -0,0 +1,371 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +public class TestScript30_50 { + + public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + VersionConvertor_30_50.copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_30_50.convertReference(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(VersionConvertor_30_50.convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r5.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilities(VersionConvertor_30_50.convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilitiesElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(VersionConvertor_30_50.convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) tgt.addAction(VersionConvertor_30_50.convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java new file mode 100644 index 000000000..85959aa17 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java @@ -0,0 +1,363 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.BooleanType; + +public class ValueSet30_50 { + + 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; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_50.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(VersionConvertor_30_50.convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getValueSet()) tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getValueSet()) tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(convertFilterOperator2(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(VersionConvertor_30_50.convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator2(org.hl7.fhir.r5.model.Enumerations.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch(src) { + case EQUAL: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EXISTS; + default: + return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + VersionConvertor_30_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/StructureDefinition/valueset-extensible"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + VersionConvertor_30_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/StructureDefinition/valueset-extensible"); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(VersionConvertor_30_50.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + 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.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDate(src.getLockedDate()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDate(src.getLockedDate()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + VersionConvertor_30_50.copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(VersionConvertor_30_50.convertType(src.getValue())); + return tgt; + } +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/Parser.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/Parser.java new file mode 100644 index 000000000..e54a205ce --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/Parser.java @@ -0,0 +1,1130 @@ +package org.hl7.fhir.convertors.parser; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.comments.Comment; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.expr.NameExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithIdentifier; +import com.github.javaparser.ast.nodeTypes.NodeWithName; +import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName; +import com.github.javaparser.ast.nodeTypes.modifiers.NodeWithStaticModifier; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.type.VarType; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration; +import com.github.javaparser.symbolsolver.JavaSymbolSolver; +import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration; +import com.github.javaparser.symbolsolver.model.resolution.TypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * TODO Line auditing function, try copying based on line numbers and based on MethodDeclr, and compare the outputs + */ +public class Parser { + + private static final List VERSION_FILES = Arrays.asList("10_30", "10_40", "10_50", "14_30", "14_40", "14_50", "30_40", "30_50"); + + private static final String COMMON_FILENAME = "Common"; + private static final String DEST_DIRECTORY_FORMAT = "conv%s"; + private static final String SRC_FILE_FORMAT = "VersionConvertor_%s"; + + private static final String KEYWORD_CONVERT = "convert"; + private static final String KEYWORD_COPY = "copy"; + private static final String KEYWORD_FIND = "find"; + private static final String KEYWORD_GOD_METHOD = "convertResource"; + + private static final String DIRECTORY_WHERE_THE_CODE_LIVES = "/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/"; + private static final String COMMENT_REPORT = "comment_report%s.txt"; + + //Exception case variables + public static final String DSTU = "dstu"; + public static final String R = "r"; + + public static final String MODEL_RESOURCE = "org.hl7.fhir.%1$s%2$s.model.Resource"; + public static final String MODEL_VALUESET = "org.hl7.fhir.%1$s%2$s.model.ValueSet"; + public static final String MODEL_BUNDLECOMP = "org.hl7.fhir.%1$s%2$s.model.Bundle.BundleEntryComponent"; + public static final String MODEL_BUNDLE = "org.hl7.fhir.%1$s%2$s.model.Bundle"; + public static final String VERSION_CONVERTOR_IMPORT = "org.hl7.fhir.convertors.VersionConvertorAdvisor%s0"; + public static final String VERSION_CONVERTOR = "VersionConvertorAdvisor%s0"; + public static final String ADVISOR_VARIABLE = "advisor"; + + public static String convertPath(String path, String version) { + String versionloc = (version.equals("2") || version.equals("3")) ? DSTU : R; + return String.format(path, versionloc, version); + } + + /** + * @param args + */ + public static void main(String[] args) { + + String projectDirectory = new File("").getAbsolutePath(); + + VERSION_FILES.forEach(version -> { + + String srcFilePathWithExtension = projectDirectory + DIRECTORY_WHERE_THE_CODE_LIVES + String.format(SRC_FILE_FORMAT, version) + ".java"; + String destDirectoryName = String.format(DEST_DIRECTORY_FORMAT, version); + + CompilationUnit compilationUnit = getCompilationUnit(srcFilePathWithExtension); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration + = initializeTypeSovlerAndParser(compilationUnit, projectDirectory, DIRECTORY_WHERE_THE_CODE_LIVES, String.format(SRC_FILE_FORMAT, version)); + + if (version.contains("10")) + dealWithV2ExceptionCasesPreProcessing(compilationUnit, classOrInterfaceDeclaration, version); + + List externalClassNames = getAdditionalClassDeclarations(classOrInterfaceDeclaration).stream() + .filter(c -> !c.getNameAsString().equals(classOrInterfaceDeclaration.getNameAsString())) + .map(NodeWithSimpleName::getNameAsString) + .collect(Collectors.toList()); + + HashMap> generatedTopLevelMethodMap = generateMapOfTopLevelMethods(classOrInterfaceDeclaration); + HashMap generatedMethodMap = new HashMap<>(); + HashMap> generatedStaticFieldMappings = new HashMap<>(); + populateMethodAndFieldMaps(classOrInterfaceDeclaration, generatedTopLevelMethodMap, generatedMethodMap, generatedStaticFieldMappings); + + if (version.equals("10_40") || version.equals("10_50")) { + generatedMethodMap.keySet().stream() + .filter(methodDeclaration -> methodDeclaration.getNameAsString().equals("hasConcept")) + .collect(Collectors.toList()) + .forEach(methodDeclaration -> { + generatedMethodMap.put(methodDeclaration, COMMON_FILENAME); + }); + } + + populateClassMappings(generatedTopLevelMethodMap, generatedMethodMap); + + createCommentReport(srcFilePathWithExtension, + projectDirectory + DIRECTORY_WHERE_THE_CODE_LIVES + String.format(COMMENT_REPORT, version)); + + modifySourceFile(compilationUnit, classOrInterfaceDeclaration, srcFilePathWithExtension, + generatedTopLevelMethodMap, generatedStaticFieldMappings, version); + + String packageDeclaration = compilationUnit.getPackageDeclaration().get().getNameAsString() + "." + + destDirectoryName; + System.out.println("Files will be generated with the package :: " + packageDeclaration); + NodeList imports = compilationUnit.getImports(); + System.out.println("Imports will be taken from the top level file <" + String.format(SRC_FILE_FORMAT, version) + ".java>, you will have to " + + "optimize imports on the generated files. Import list as follows :: \n-----"); + imports.stream().map(NodeWithName::getNameAsString).forEach(System.out::println); + System.out.println("-----\n"); + String directoryPath = projectDirectory + DIRECTORY_WHERE_THE_CODE_LIVES + destDirectoryName + "/"; + createDirectory(directoryPath); + System.out.println("Generated type conversion files will be stored in :: " + directoryPath); + + createJavaFiles(classOrInterfaceDeclaration, generatedTopLevelMethodMap, generatedStaticFieldMappings, + String.format(SRC_FILE_FORMAT, version), packageDeclaration, imports, directoryPath, externalClassNames, version); + }); + + + } + + private static List getAdditionalClassDeclarations(ClassOrInterfaceDeclaration classOrInterfaceDeclaration) { + List collect = new ArrayList<>(); + classOrInterfaceDeclaration.accept(new VoidVisitorAdapter() { + @Override + public void visit(ClassOrInterfaceDeclaration n, Void arg) { + super.visit(n, arg); + collect.add(n); + } + }, null); + return collect; + } + + private static CompilationUnit getCompilationUnit(String filePathWithExtension) { + Optional compilationUnit = initializeParser(filePathWithExtension); + if (!compilationUnit.isPresent()) { + System.out.println("\nNo compilation unit generated during class parsing...aborting."); + System.exit(0); + } + return compilationUnit.get(); + } + + private static ClassOrInterfaceDeclaration initializeTypeSovlerAndParser(CompilationUnit compilationUnit, + String projectDirectory, + String codeDirectory, + String filename) { + System.out.println("==================== Initializing TypeSolver and Parser ====================\n"); + + try { + initializeResolver(projectDirectory, codeDirectory); + } catch (IOException e) { + System.out.println("Error initializing typesolver, exiting process..."); + e.printStackTrace(); + System.exit(0); + } + + System.out.println("Loading class: " + filename); + Optional classOrInterfaceDeclaration = loadClass(compilationUnit, filename); + if (!classOrInterfaceDeclaration.isPresent()) { + System.out.println("\nNo class or interface declaration loaded during parsing...aborting."); + System.exit(0); + } + + System.out.println("\n"); + + return classOrInterfaceDeclaration.get(); + } + + private static HashMap> generateMapOfTopLevelMethods(ClassOrInterfaceDeclaration classOrInterfaceDeclaration) { + System.out.println("==================== Generating List of Parsable Types ====================\n"); + + HashMap> mapToReturn = new HashMap<>(); + + System.out.println("Fetching list of top level parsing methods..."); + System.out.println("---------------------------------------------"); + List listOfParsableMethodCalls = getListOfParsableTypes(classOrInterfaceDeclaration).stream() + .map(methodCallExpr -> methodCallExpr.getName().toString()) + .sorted(Comparator.comparing(Function.identity())) + .distinct() + .collect(Collectors.toList()); + listOfParsableMethodCalls.forEach(System.out::println); + System.out.println("---------------------------------------------"); + System.out.println("\n"); + + System.out.println("==================== Generate Map of Top Level Method Names ====================\n"); + System.out.println("Pulling all top level methods from the parsed class --> " + classOrInterfaceDeclaration.getNameAsString()); + List topLevelMethods = getTopLevelMethods(classOrInterfaceDeclaration, listOfParsableMethodCalls); + System.out.println("\nFetched the following top level methods:"); + System.out.println("------------------------------------------"); + topLevelMethods.forEach(md -> System.out.println(md.getSignature().toString())); + System.out.println("------------------------------------------\n"); + System.out.println("\n"); + + for (String type : listOfParsableMethodCalls) { + topLevelMethods.stream() + .filter(methodDeclaration -> type.equals(methodDeclaration.getName().asString())) + .forEach(md -> { + if (!mapToReturn.containsKey(type.replaceFirst(KEYWORD_CONVERT, ""))) { + mapToReturn.put(type.replaceFirst(KEYWORD_CONVERT, ""), new ArrayList<>()); + } + mapToReturn.get(type.replaceFirst(KEYWORD_CONVERT, "")).add(md); + }); + } + return mapToReturn; + } + + public static void populateMethodAndFieldMaps(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + HashMap> generatedTopLevelMethodMap, + HashMap methodMapToPopulate, + HashMap> fieldMapToPopulate) { + + System.out.println("==================== Generate Method and Field Maps ====================\n"); + + HashMap fieldDeclarationMap = new HashMap<>(); + + List fieldDeclarations = classOrInterfaceDeclaration.getFields().stream() + .filter(NodeWithStaticModifier::isStatic) + .collect(Collectors.toList()); + + for (String key : generatedTopLevelMethodMap.keySet()) { + for (MethodDeclaration md : generatedTopLevelMethodMap.get(key)) { + recursiveSearchAndAdd(classOrInterfaceDeclaration, methodMapToPopulate, fieldDeclarationMap, fieldDeclarations, md, key); + } + } + + fieldDeclarationMap.keySet().forEach(key -> { + if (!fieldMapToPopulate.containsKey(fieldDeclarationMap.get(key))) { + fieldMapToPopulate.put(fieldDeclarationMap.get(key), new ArrayList<>()); + } + fieldMapToPopulate.get(fieldDeclarationMap.get(key)).add(key); + }); + } + + public static void populateClassMappings(HashMap> generatedTopLevelMethodMap, + HashMap generatedMethodMap) { + System.out.println("==================== Generate Method to Class Mappings ====================\n"); + + generatedTopLevelMethodMap.put(COMMON_FILENAME, new ArrayList<>()); + generatedTopLevelMethodMap.clear(); + generatedMethodMap.keySet().forEach(md -> { + if (!generatedTopLevelMethodMap.containsKey(generatedMethodMap.get(md))) { + generatedTopLevelMethodMap.put(generatedMethodMap.get(md), new ArrayList<>()); + } + generatedTopLevelMethodMap.get(generatedMethodMap.get(md)).add(md); + }); + + for (String className : generatedTopLevelMethodMap.keySet()) { + System.out.println("Class :: " + className); + generatedTopLevelMethodMap.get(className).stream() + .sorted(Comparator.comparing(methodDeclaration -> methodDeclaration.getName().toString())) + .forEach(md -> System.out.println("\t" + md.getSignature())); + System.out.println("\n"); + } + } + + public static void createCommentReport(String fullSrcFilePath, String fullDstFilePath) { + try { + List commentReportEntries = generateCommentReportData(fullSrcFilePath); + String report = commentReportEntries.stream() + .map(Object::toString).collect(Collectors.joining("\n")); + writeStringToFile(report, fullDstFilePath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void dealWithV2ExceptionCasesPreProcessing(CompilationUnit cu, ClassOrInterfaceDeclaration classOrInterfaceDeclaration, String version) { + String from = "2";//version.substring(0, version.indexOf('_')); + String to = version.substring(version.indexOf('_') + 1, version.indexOf('_') + 2); + + + modifyConvertResourceCalls(classOrInterfaceDeclaration, to, from, to, MODEL_VALUESET, "convertValueSet"); + modifyConvertResourceCalls(classOrInterfaceDeclaration, from, to, to, MODEL_VALUESET, "convertValueSet"); + modifyConvertResourceCalls(classOrInterfaceDeclaration, to, from, to, MODEL_BUNDLECOMP, "convertBundleEntryComponent"); + modifyConvertResourceCalls(classOrInterfaceDeclaration, to, from, to, MODEL_BUNDLE, "convertBundle"); + + addAdvisorToMethodCalls(classOrInterfaceDeclaration, "convertBundle", MODEL_BUNDLE, from, "convertBundleEntryComponent"); + + } + + public static void dealWithV2ExceptionCasesPostProcessing(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, String version) { + String from = "2";//version.substring(0, version.indexOf('_')); + String to = version.substring(version.indexOf('_') + 1, version.indexOf('_') + 2); + + Optional advisorOptional = classOrInterfaceDeclaration.getFields().stream() + .map(FieldDeclaration::getVariables) + .flatMap(Collection::stream) + .filter(v -> v.getNameAsString().equals(ADVISOR_VARIABLE)) + .findFirst(); + + if (advisorOptional.isPresent()) { + VariableDeclarator advisorVariable = advisorOptional.get(); + Type advisorType = advisorVariable.getType(); + advisorOptional.get().getParentNode().ifPresent(Node::remove); + + modifyConvertResourceCalls(classOrInterfaceDeclaration, from, to, to, MODEL_RESOURCE, "convertResource"); + modifyConvertResourceCalls(classOrInterfaceDeclaration, to, from, to, MODEL_RESOURCE, "convertResource"); + + addAdvisorToMethodCalls(classOrInterfaceDeclaration, "convertResource", MODEL_RESOURCE, from, "convertBundle"); + addAdvisorToMethodCalls(classOrInterfaceDeclaration, "convertResource", MODEL_RESOURCE, from, "convertValueSet"); + addAdvisorToMethodCalls(classOrInterfaceDeclaration, "convertResource", MODEL_RESOURCE, to, "convertValueSet"); + + classOrInterfaceDeclaration.getConstructors().forEach(Node::remove); + + System.out.println(); +// classOrInterfaceDeclaration.addMethod(); + + } + + System.out.println(); + } + + public static void modifyConvertResourceCalls(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + String parameterVersionNo, + String typeVersionNo, + String convertorVersionNumber, + String typeFormat, + String methodName) { + MethodDeclaration oldConvertResource = getConvertResourceMethodForVersion(classOrInterfaceDeclaration, methodName, typeFormat, typeVersionNo); + oldConvertResource.addParameter(String.format(VERSION_CONVERTOR, convertorVersionNumber), ADVISOR_VARIABLE); + + MethodDeclaration newConvertResource = classOrInterfaceDeclaration.addMethod(methodName); + newConvertResource.setModifier(Modifier.Keyword.PUBLIC, true); + newConvertResource.setModifier(Modifier.Keyword.STATIC, true); + newConvertResource.setType(convertPath(typeFormat, typeVersionNo)); + newConvertResource.setThrownExceptions(oldConvertResource.getThrownExceptions()); + newConvertResource.addParameter(convertPath(typeFormat, parameterVersionNo), "src"); + newConvertResource.setBody(new BlockStmt().addStatement("return " + methodName + "(src, null);")); + } + + public static void addAdvisorToMethodCalls(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + String parentMethodName, + String modelType, + String version, + String subMethodCall) { + + Optional methodDeclaration = classOrInterfaceDeclaration.getMethods().stream() + .filter(md -> md.getNameAsString().equals(parentMethodName)) + .filter(md -> md.getType().toString().equals(convertPath(modelType, version))) + .findAny(); + + methodDeclaration.ifPresent(declaration -> declaration.accept(new ModifierVisitor() { + @Override + public Visitable visit(MethodCallExpr n, Void arg) { + super.visit(n, arg); + if(n.getNameAsString().contains(subMethodCall)){ + n.addArgument("advisor"); + } + return n; + } + }, null)); + + } + + public static MethodDeclaration getConvertResourceMethodForVersion(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + String methodName, + String modelType, + String version) { + Optional methodDeclaration = classOrInterfaceDeclaration.getMethods().stream() + .filter(md -> md.getNameAsString().equals(methodName)) + .filter(md -> md.getType().toString().equals(convertPath(modelType, version))) + .findAny(); + + if (methodDeclaration.isPresent()) { + return methodDeclaration.get(); + } else { + System.out.println("Cannot find method " + methodName + " that returns type " + convertPath(modelType, version)); + System.exit(0); + } + return null; + } + + public static void modifySourceFile(CompilationUnit compilationUnit, + ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + String srcFilePathWithExtension, + HashMap> generatedTopLevelMethodMap, + HashMap> generatedStaticFieldMappings, + String version) { + + + List listOfParsableMethodCalls = getListOfParsableTypes(classOrInterfaceDeclaration).stream() + .map(methodCallExpr -> methodCallExpr.getName().toString()) + .sorted(Comparator.comparing(Function.identity())) + .distinct() + .collect(Collectors.toList()); + + modifyMainFile(compilationUnit, + classOrInterfaceDeclaration, + generatedTopLevelMethodMap.get(COMMON_FILENAME), + generatedTopLevelMethodMap.keySet().stream() + .filter(key -> !key.equals(COMMON_FILENAME)) + .map(generatedTopLevelMethodMap::get) + .flatMap(Collection::stream) + .collect(Collectors.toList()), + listOfParsableMethodCalls, + generatedStaticFieldMappings.keySet().stream() + .filter(key -> !key.equals(COMMON_FILENAME)) + .map(generatedStaticFieldMappings::get) + .flatMap(Collection::stream) + .collect(Collectors.toList()), + generatedStaticFieldMappings.keySet().stream() + .filter(key -> key.equals(COMMON_FILENAME)) + .map(generatedStaticFieldMappings::get) + .flatMap(Collection::stream) + .collect(Collectors.toList()), + version); + + deleteFile(srcFilePathWithExtension); + + try { + writeStringToFile(compilationUnit.toString(), srcFilePathWithExtension); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void modifyMainFile(CompilationUnit compilationUnit, + ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + List methodsToExpose, + List methodsToDelete, + List methodsToAddStaticAccess, + List fieldsToDelete, + List fieldsToExpose, + String versionCode) { + + compilationUnit.getAllContainedComments().stream() + .filter(Comment::isLineComment) + .forEach(Comment::remove); + + compilationUnit.accept(new MethodDeleter(methodsToDelete), null); + compilationUnit.accept(new MethodExposer(methodsToExpose), null); + + compilationUnit.addImport("org.hl7.fhir.convertors." + String.format(DEST_DIRECTORY_FORMAT, versionCode), false, true); + + fieldsToDelete.forEach(classOrInterfaceDeclaration::remove); + classOrInterfaceDeclaration.getFields().stream() + .filter(NodeWithStaticModifier::isStatic) + .filter(fieldsToExpose::contains) + .forEach(fd -> { + fd.setModifier(Modifier.Keyword.PRIVATE, false); + fd.setModifier(Modifier.Keyword.PUBLIC, true); + }); + + List listOfClassMethods = getListOfClassMethods(KEYWORD_GOD_METHOD, classOrInterfaceDeclaration); + listOfClassMethods.forEach(md -> { + md.accept(new MethodStaticCallAdder(methodsToAddStaticAccess, versionCode), null); + }); + + //Deal with the old, non static access convertors (1-3, 1-4, 1-5) + compilationUnit.accept(new ModifierVisitor() { + @Override + public MethodDeclaration visit(MethodDeclaration md, Void arg) { + super.visit(md, arg); + + md.setModifier(Modifier.Keyword.PRIVATE, false); + md.setModifier(Modifier.Keyword.STATIC, true); + md.setModifier(Modifier.Keyword.PUBLIC, true); + + return md; + } + }, null); + + classOrInterfaceDeclaration.accept(new ModifierVisitor() { + @Override + public ClassOrInterfaceDeclaration visit(ClassOrInterfaceDeclaration n, Void arg) { + super.visit(n, arg); + if (!n.getNameAsString().equals(String.format(SRC_FILE_FORMAT, versionCode))) { + n.setModifier(Modifier.Keyword.PRIVATE, false); + n.setModifier(Modifier.Keyword.STATIC, true); + n.setModifier(Modifier.Keyword.PUBLIC, true); + n.accept(new ModifierVisitor() { + @Override + public FieldDeclaration visit(FieldDeclaration md, Void arg) { + super.visit(md, arg); + md.setModifier(Modifier.Keyword.PRIVATE, false); + md.setModifier(Modifier.Keyword.STATIC, false); + md.setModifier(Modifier.Keyword.PUBLIC, true); + return md; + } + }, null); + } + return n; + } + }, null); + + if (versionCode.contains("10")) dealWithV2ExceptionCasesPostProcessing(classOrInterfaceDeclaration, versionCode); + + } + + public static void createJavaFiles(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, + HashMap> generatedTopLevelMethodMap, + HashMap> generatedStaticFieldMappings, + String filename, + String packageDeclaration, + NodeList imports, + String outputDirectoryPath, + List externalClassNames, + String version) { + System.out.println("==================== Create Java Files ====================\n"); + + generatedTopLevelMethodMap.keySet().stream() + .filter(s -> !s.equals(COMMON_FILENAME)) + .forEach(s -> { + String generatedCode = generateFileContents(classOrInterfaceDeclaration, + filename, + s + version, + packageDeclaration, + imports, + generatedStaticFieldMappings.get(s), + generatedStaticFieldMappings.get(COMMON_FILENAME), + generatedTopLevelMethodMap.get(s).stream() + .sorted(Comparator.comparing(methodDeclaration -> methodDeclaration.getName().toString())) + .collect(Collectors.toList()), + externalClassNames, + version); + + try { + String filePath = outputDirectoryPath + s + version + ".java"; + System.out.println("Attempting to write file -> " + filePath); + writeStringToFile(generatedCode, filePath); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } + + public static void writeStringToFile(String string, String filepath) throws IOException { + BufferedWriter writer = new BufferedWriter(new FileWriter(filepath)); + writer.write(string); + writer.close(); + } + + public static String generateFileContents(ClassOrInterfaceDeclaration oldInterfaceDec, + String commonMethodClassName, + String className, + String packageDeclaration, + NodeList imports, + List fieldDeclarations, + List externalFieldDeclarations, + List methods, + List externalClassNames, + String version) { + + CompilationUnit cu = new CompilationUnit(); + + + cu.setPackageDeclaration(packageDeclaration); + cu.setImports(imports); + cu.addImport("org.hl7.fhir.convertors." + String.format(SRC_FILE_FORMAT, version)); + cu.addImport("org.hl7.fhir.convertors.VersionConvertorConstants"); + if (version.contains("10")) + cu.addImport(String.format(VERSION_CONVERTOR_IMPORT, version.substring(version.indexOf('_') + 1, version.indexOf('_') + 2))); + + ClassOrInterfaceDeclaration generatedClass = cu.addClass(className); + if (fieldDeclarations != null) { + fieldDeclarations.forEach(generatedClass::addMember); + } + + methods.forEach(method -> { + + MethodDeclaration methodDeclaration = generatedClass.addMethod(method.getNameAsString()); + + if (method.getBody().isPresent()) { + BlockStmt blockStmt = method.getBody().get(); + if (externalFieldDeclarations != null) { + blockStmt.accept(new VarAccessChanger(externalFieldDeclarations.stream() + .map(fd -> fd.getVariable(0).getNameAsString()) + .collect(Collectors.toList()), String.format(SRC_FILE_FORMAT, version)), null); + } + List allCalledMethods = getAllCalledMethods(oldInterfaceDec, method); + + allCalledMethods.stream() + .filter(md -> !methods.contains(md)) + .map(NodeWithSimpleName::getNameAsString) + .distinct() + .forEach(methodName -> { + List methodCallExprs = new ArrayList<>(); + blockStmt.accept(new MethodCallVisitor(methodName, true), methodCallExprs); + methodCallExprs.stream() + .distinct() + .forEach(methodCallExpr -> { + methodCallExpr.setName(commonMethodClassName + "." + methodCallExpr.getNameAsString()); + }); + }); + methodDeclaration.setBody(blockStmt); + + } + + methodDeclaration.setParameters(method.getParameters()); + methodDeclaration.setModifiers(method.getModifiers()); + methodDeclaration.addModifier(Modifier.Keyword.STATIC); + methodDeclaration.setModifier(Modifier.Keyword.PRIVATE, false); + methodDeclaration.setModifier(Modifier.Keyword.PUBLIC, true); + methodDeclaration.setThrownExceptions(method.getThrownExceptions()); + methodDeclaration.setType(method.getType()); + methodDeclaration.setTypeParameters(method.getTypeParameters()); + }); + + + generatedClass.walk(node -> { + String identifier = ""; + if (node instanceof NodeWithIdentifier) + if (externalClassNames.contains(((NodeWithIdentifier) node).getIdentifier())) { + ((NodeWithIdentifier) node).setIdentifier(String.format(SRC_FILE_FORMAT, version) + "." + ((NodeWithIdentifier) node).getIdentifier()); + } + }); + + return cu.toString(); + } + + public static Predicate distinctByKey(Function keyExtractor) { + Set seen = ConcurrentHashMap.newKeySet(); + return t -> seen.add(keyExtractor.apply(t)); + } + + private static void recursiveSearchAndAdd(ClassOrInterfaceDeclaration cd, + HashMap methodDeclarationMap, + HashMap fieldDeclarationMap, + List globalStaticFields, + MethodDeclaration key, + String value) { + if (methodDeclarationMap.containsKey(key) && (methodDeclarationMap.get(key).equals(COMMON_FILENAME) || methodDeclarationMap.get(key).equals(value))) + return; + if (key.getName().toString().equals("convertResource")) return; + + addMethodDeclarationToMap(methodDeclarationMap, value, key); + searchAndSortMethodFields(key, value, fieldDeclarationMap, globalStaticFields); + + getAllCalledMethods(cd, key).forEach(md -> { + recursiveSearchAndAdd(cd, methodDeclarationMap, fieldDeclarationMap, globalStaticFields, md, value); + }); + + } + + private static void searchAndSortMethodFields(MethodDeclaration md, + String classKey, + HashMap fieldToClassMap, + List fieldDeclarations) { + + List collector = new ArrayList<>(); + md.accept(new MethodFieldVisitor(), collector); + + md.accept(new VoidVisitorAdapter() { + @Override + public void visit(VarType n, Void arg) { + super.visit(n, arg); + } + }, null); + + List staticFieldLabels = fieldDeclarations.stream() + .map(fd -> fd.getVariable(0).getName().asString()) + .collect(Collectors.toList()); + + collector.stream() + .filter(ne -> staticFieldLabels.contains(ne.getNameAsString())) + .map(ne -> fieldDeclarations.stream() + .filter(fd -> fd.getVariable(0).getName().asString().equals(ne.getNameAsString())) + .findFirst() + .get()) + .forEach(fd -> { + if (!fieldToClassMap.containsKey(fd)) { + fieldToClassMap.put(fd, classKey); + } else if (!fieldToClassMap.get(fd).equals(classKey)) { + fieldToClassMap.put(fd, COMMON_FILENAME); + } + }); + } + + + private static void createDirectory(String path) { + File file = new File(path); + //Creating the directory + boolean bool = file.mkdir(); + if (bool) { + System.out.println("Directory created successfully"); + } else { + System.out.println("Sorry couldn’t create specified directory"); + } + } + + /** + * Attempts to delete the file at the given path.) + * + * @param path + */ + public static void deleteFile(String path) { + File file = new File(path); + if (file.delete()) { + System.out.println("File <" + path + "> deleted successfully"); + } else { + System.out.println("Failed to delete the file <" + path + ">"); + } + } + + /** + * Finds the god method in the given convertor, and parses out all the method calls that method makes. + * + * @param classOrInterfaceDeclaration + * @return + */ + protected static List getListOfParsableTypes(ClassOrInterfaceDeclaration classOrInterfaceDeclaration) { + List listOfClassMethods = getListOfClassMethods(KEYWORD_GOD_METHOD, classOrInterfaceDeclaration); + List calledMethods = new ArrayList<>(); + listOfClassMethods.forEach(md -> md.accept(new MethodCallVisitor(KEYWORD_CONVERT), calledMethods)); + return calledMethods; + } + + /** + * Pulls all internal conversion method calls out of the passed in method and maps those calls to the corresponding + * {@link MethodDeclaration} and returns those as a list. + * + * @param classOrInterfaceDeclaration + * @param method + * @return List of all {@link MethodDeclaration} + */ + public static List getAllCalledMethods(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, MethodDeclaration method) { + List result = new ArrayList<>(); + + List methodCallExprs = new ArrayList<>(); + method.accept(new VoidVisitorAdapter>() { + @Override + public void visit(MethodCallExpr methodCallExpr, List collector) { + collector.add(methodCallExpr); + super.visit(methodCallExpr, collector); + } + }, methodCallExprs); +// method.accept(new MethodCallVisitor(KEYWORD_CONVERT), methodCallExprs); +// method.accept(new MethodCallVisitor(KEYWORD_COPY), methodCallExprs); +// method.accept(new MethodCallVisitor(KEYWORD_FIND), methodCallExprs); + + Set methodExpressionNames = methodCallExprs.stream() + .filter(methodCallExpr -> !methodCallExpr.getScope().isPresent()) + .map(me -> me.getName().toString()) + .collect(Collectors.toSet()); + + classOrInterfaceDeclaration.getMethods().stream() + .filter(e -> methodExpressionNames.contains(e.getName().toString())) + .collect(Collectors.toCollection(() -> result)); + + return result; + } + + /** + * Searches the passed in {@link ClassOrInterfaceDeclaration} for any method declaration matching any of the method + * names in the passed in List. + * + * @param classOrInterfaceDeclaration {@link ClassOrInterfaceDeclaration} to search + * @param methodNames {@link List} of method names + * @return {@link List } containing any of the keywords + */ + protected static List getTopLevelMethods(ClassOrInterfaceDeclaration classOrInterfaceDeclaration, List methodNames) { + List toReturn = new ArrayList<>(); + methodNames.stream() + .map(s -> getListOfClassMethods(s, classOrInterfaceDeclaration)) + .flatMap(List::stream) + .collect(Collectors.toCollection(() -> toReturn)); + return toReturn; + } + + /** + * Searched the generated declaration map for the matching {@link MethodDeclaration}, if it already exists within the + * map and is not currently pointing the class label we pass in, it will mark it with the {@link Parser#COMMON_FILENAME} + * + * @param className {@link String} class label we want to associate the method with + * @param methodDeclaration {@link MethodDeclaration} + */ + protected static void addMethodDeclarationToMap(HashMap map, + String className, MethodDeclaration methodDeclaration) { + if (!map.containsKey(methodDeclaration)) { + map.put(methodDeclaration, className); + } else if (!map.get(methodDeclaration).equals(className)) { + map.put(methodDeclaration, COMMON_FILENAME); + } + } + + /** + * Returns a list of all java files within the passed in directory path, without extension. + * + * @param path {@link String} filepath + * @return {@link List < String >} of all filenames + */ + protected static List listAllJavaFilesInDirectory(String path) { + List result = new ArrayList<>(); + + try (Stream walk = Files.walk(Paths.get(path))) { + walk.map(Path::toString) + .filter(f -> f.endsWith(".java")) + .map(Parser::pullFileNameFromPath) + .collect(Collectors.toCollection(() -> result)); + } catch (IOException e) { + e.printStackTrace(); + } + + return result; + } + + /** + * Takes the passed in file path and extracts the filename without extension. + * + * @param path + * @return + */ + protected static String pullFileNameFromPath(String path) { + int lastSlashIndex = path.lastIndexOf('/'); + int lastPeriodIndex = path.lastIndexOf('.'); + return path.substring(lastSlashIndex + 1, lastPeriodIndex); + } + + /** + * The parser works by listing method calls within the individual resource conversion methods as + * {@link MethodCallExpr}. To extract the information we need to refactor the code, + * such as method body, references, signature, etc, we rely on the javaparser {@link TypeSolver} to parse the code + * library and convert the expressions to concrete {@link MethodDeclaration}. + *

+ * NB. The more source files in the directory you pass in (this will search recursively), the longer the + * MethodDeclaration lookups will take. Be smart, choose S-Mart. + * + * @param rootProjectDirectory + * @param projectDirectory {@link String} path to the directory that contains the souce files we want to be available for + */ + public static void initializeResolver(String rootProjectDirectory, String projectDirectory) throws IOException { + System.out.println("Initializing resolver against the following root directory:\n" + rootProjectDirectory); + System.out.println("Project codebase located here:\n" + projectDirectory); + + TypeSolver myTypeSolver = new CombinedTypeSolver( + new ReflectionTypeSolver(), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.convertors/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.utilities/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu2/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu3/src/main/java/")), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-structures-r4/4.1.0/hapi-fhir-structures-r4-4.1.0.jar"), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-base/4.1.0/hapi-fhir-base-4.1.0.jar") + ); + + JavaSymbolSolver symbolSolver = new JavaSymbolSolver(myTypeSolver); + StaticJavaParser.getConfiguration().setSymbolResolver(symbolSolver); + } + + /** + * Initializes the parser and runs it against the file located at the passed in path. + * + * @param path {@link String} path to the file. + * @return {@link Optional } + */ + public static Optional initializeParser(String path) { + System.out.println("Initializing parser, and parsing the following file:\n" + path); + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(path)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return Optional.ofNullable(compilationUnit); + } + + /** + * Loads a class using the {@link CompilationUnit} passed in and returns the resulting declaration for parsing. This + * class must exist within the directory parsed originally in {@link #initializeParser(String)} + * + * @param cu {@link CompilationUnit} + * @param classname {@link String} The name of the class to load. + * @return {@link Optional } for the named class. + */ + protected static Optional loadClass(CompilationUnit cu, String classname) { + return cu.getClassByName(classname); + } + + /** + * Takes a given {@link MethodCallExpr} and uses the initialized {@link JavaSymbolSolver} to search the source code + * for the appropriate {@link MethodDeclaration}. + * + * @param methodCallExpr {@link MethodCallExpr} + * @return An {@link Optional}, containing the corresponding {@link MethodDeclaration} + */ + protected static Optional resolveMethodDeclaration(MethodCallExpr methodCallExpr) { + MethodDeclaration wrappedDeclaration = null; + ResolvedMethodDeclaration correspondingDeclaration = methodCallExpr.resolve(); + + if (correspondingDeclaration instanceof JavaParserMethodDeclaration) { + JavaParserMethodDeclaration declaration = (JavaParserMethodDeclaration) correspondingDeclaration; + Node wrappedNode = declaration.getWrappedNode(); + wrappedDeclaration = (MethodDeclaration) wrappedNode; + System.out.println(); + } + + return Optional.ofNullable(wrappedDeclaration); + } + + /** + * Takes the content {@link String} passed in, and writes it to a java file with the provided name, in the provided + * directory location. + * + * @param filename Name of the file, including extension, ex: "Book.java" + * @param directory Path to directory to create the file + * @param content {@link String} content of the file + * @throws IOException + */ + public static void writeJavaCodeToFile(String filename, String directory, String content) throws IOException { + BufferedWriter writer = new BufferedWriter(new FileWriter(directory + filename)); + writer.write(content); + writer.close(); + } + + /** + * Returns the list of class methods. + * + * @param classOrInterfaceDeclaration {@link ClassOrInterfaceDeclaration} + * @return {@link List} of all {@link MethodDeclaration} + */ + protected static List getListOfClassMethods(ClassOrInterfaceDeclaration classOrInterfaceDeclaration) { + return getListOfClassMethods("", classOrInterfaceDeclaration); + } + + /** + * Returns the list of class methods containing the passed in method name. + * + * @param methodName {@link String} method name to search for + * @param classOrInterfaceDeclaration {@link ClassOrInterfaceDeclaration} + * @return {@link List} of all matching {@link MethodDeclaration} + */ + protected static List getListOfClassMethods(String methodName, ClassOrInterfaceDeclaration classOrInterfaceDeclaration) { + List result = new ArrayList<>(); + classOrInterfaceDeclaration.getMethods().stream() + .filter(method -> method.getName().toString().equals(methodName)) + .collect(Collectors.toCollection(() -> result)); + return result; + } + + private static List generateCommentReportData(String filepath) throws FileNotFoundException { + + CompilationUnit cu = StaticJavaParser.parse(new File(filepath)); + + return cu.getAllContainedComments().stream() + .filter(Comment::isOrphan) + .filter(Comment::isLineComment) + .map(p -> new CommentReportEntry(filepath.substring(filepath.lastIndexOf('/') + 1), + p.getClass().getSimpleName(), p.getContent(), p.getRange().get().begin.line, + !p.getCommentedNode().isPresent())) + .collect(Collectors.toList()); + } + + /** + * Class that visits all method calls within a given method and returns the results as a list. + */ + public static class MethodCallVisitor extends VoidVisitorAdapter> { + + private final String keyword; + private final boolean strict; + + public MethodCallVisitor(String keywords) { + super(); + this.keyword = keywords; + this.strict = false; + } + + public MethodCallVisitor(String keywords, boolean strict) { + super(); + this.keyword = keywords; + this.strict = strict; + } + + @Override + public void visit(MethodCallExpr methodCallExpr, List collector) { + if (strict) { + if (methodCallExpr.getName().asString().equals(keyword)) { + collector.add(methodCallExpr); + } + } else { + if (methodCallExpr.getName().asString().contains(keyword)) { + collector.add(methodCallExpr); + } + } + super.visit(methodCallExpr, collector); + } + } + + /** + * Class that visits all method calls within a given method and returns the results as a list. + */ + public static class MethodFieldVisitor extends VoidVisitorAdapter> { + + public MethodFieldVisitor() { + super(); + } + + @Override + public void visit(NameExpr fieldAccessExpr, List collector) { + super.visit(fieldAccessExpr, collector); + collector.add(fieldAccessExpr); + } + } + + /** + * Class that visits all method calls within a given method and returns the results as a list. + */ + public static class VarAccessChanger extends ModifierVisitor { + + private final List varsToAccessInMainFile; + private final String parentClassName; + + public VarAccessChanger(List varsToAccessInMainFile, String parentClassName) { + super(); + this.varsToAccessInMainFile = varsToAccessInMainFile; + this.parentClassName = parentClassName; + } + + @Override + public NameExpr visit(NameExpr nameExpr, Void arg) { + super.visit(nameExpr, arg); + if (varsToAccessInMainFile.contains(nameExpr.getNameAsString())) { + nameExpr.setName(parentClassName + "." + nameExpr.getNameAsString()); + } + return nameExpr; + } + } + + /** + * Class that visits all methods and deletes them if they are in the list of passed in MethodDeclarations + */ + public static class MethodDeleter extends ModifierVisitor { + + private List toDelete; + + public MethodDeleter(List toDelete) { + this.toDelete = toDelete; + } + + @Override + public MethodDeclaration visit(MethodDeclaration md, Void arg) { + super.visit(md, arg); + if (toDelete.contains(md)) { + return null; + } + return md; + } + } + + /** + * Class that visits all methods and deletes them if they are in the list of passed in MethodDeclarations + */ + public static class MethodExposer extends ModifierVisitor { + + private List toModify; + + public MethodExposer(List toModify) { + this.toModify = toModify; + } + + @Override + public MethodDeclaration visit(MethodDeclaration md, Void arg) { + super.visit(md, arg); + if (toModify.contains(md)) { + md.setModifier(Modifier.Keyword.PRIVATE, false); + md.setModifier(Modifier.Keyword.STATIC, true); + md.setModifier(Modifier.Keyword.PUBLIC, true); + } + return md; + } + } + + /** + * Class that visits all calls in calls and changes the access to an external class if it matches one of the passed + * in labels. + */ + public static class MethodStaticCallAdder extends ModifierVisitor { + + private List methodNames; + private String versionCode; + + public MethodStaticCallAdder(List methodNames, String versionCode) { + this.methodNames = methodNames; + this.versionCode = versionCode; + } + + @Override + public MethodCallExpr visit(MethodCallExpr methodCallExpr, Void arg) { + super.visit(methodCallExpr, arg); + if (methodNames.contains(methodCallExpr.getNameAsString())) { + //eg. convertPatient -> Patient30_50.convertPatient + methodCallExpr.setName(methodCallExpr.getNameAsString().replace(KEYWORD_CONVERT, "") + + versionCode + "." + methodCallExpr.getNameAsString()); + } + return methodCallExpr; + } + } + + private static class CommentReportEntry { + public String filename; + public String type; + public String text; + public int lineNumber; + public boolean isOrphan; + + CommentReportEntry(String filename, String type, String text, int lineNumber, + boolean isOrphan) { + this.filename = filename; + this.type = type; + this.text = text; + this.lineNumber = lineNumber; + this.isOrphan = isOrphan; + } + + @Override + public String toString() { + return filename + " | " + lineNumber + " | " + type + " | " + text.replaceAll("\\n", "").trim(); + } + } +} + diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java index 85abda16f..440b85043 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -41,11 +41,7 @@ import ca.uhn.fhir.context.FhirContext; import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.r5.model.Reference; -import org.hl7.fhir.convertors.VersionConvertorConstants; -import org.hl7.fhir.convertors.VersionConvertor_10_50; -import org.hl7.fhir.convertors.VersionConvertor_14_50; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.*; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.PathEngineException; @@ -3726,7 +3722,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat case DSTU1: throw new FHIRException("Unsupported version R1"); case DSTU2: org.hl7.fhir.dstu2.model.Resource r2 = new org.hl7.fhir.dstu2.formats.JsonParser().parse(json); - Resource r5 = new VersionConvertor_10_50(null).convertResource(r2); + Resource r5 = VersionConvertor_10_50.convertResource(r2); if (r5 instanceof Questionnaire) return (Questionnaire) r5; else diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java index 9e4a047a6..1570889b3 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java @@ -24,12 +24,7 @@ package org.hl7.fhir.r5.validation; import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.hl7.fhir.convertors.VersionConvertorAdvisor40; -import org.hl7.fhir.convertors.VersionConvertorAdvisor50; -import org.hl7.fhir.convertors.VersionConvertor_10_50; -import org.hl7.fhir.convertors.VersionConvertor_14_50; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.*; import org.hl7.fhir.exceptions.FHIRException; /** @@ -363,8 +358,7 @@ public class NativeHostServices { } else if (VersionUtilities.isR2Ver(version)) { org.hl7.fhir.dstu2.formats.ParserBase p2 = org.hl7.fhir.dstu2.formats.FormatUtilities.makeParser(fmt); org.hl7.fhir.dstu2.model.Resource res2 = p2.parse(r); - VersionConvertor_10_50 conv = new VersionConvertor_10_50(conv_10_50_advisor ); - Resource res4 = conv.convertResource(res2); + Resource res4 = VersionConvertor_10_50.convertResource(res2, conv_10_50_advisor); org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); convertCount++; return p4.composeBytes(res4); @@ -415,8 +409,7 @@ public class NativeHostServices { } else if ("1.0".equals(version) || "1.0.2".equals(version) || "r2".equals(version)) { org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); org.hl7.fhir.r5.model.Resource res4 = p4.parse(r); - VersionConvertor_10_50 conv = new VersionConvertor_10_50(conv_10_50_advisor ); - org.hl7.fhir.dstu2.model.Resource res2 = conv.convertResource(res4); + org.hl7.fhir.dstu2.model.Resource res2 = VersionConvertor_10_50.convertResource(res4, conv_10_50_advisor); org.hl7.fhir.dstu2.formats.ParserBase p2 = org.hl7.fhir.dstu2.formats.FormatUtilities.makeParser(fmt); unConvertCount++; return p2.composeBytes(res2); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java index 17ef385f0..e2cd2093d 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java @@ -1,152 +1,27 @@ package org.hl7.fhir.r5.validation; -import java.io.BufferedOutputStream; - -/*- - * #%L - * org.hl7.fhir.validation - * %% - * Copyright (C) 2014 - 2019 Health Level 7 - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - - -/* -Copyright (c) 2011+, HL7, Inc -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of HL7 nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.HttpURLConnection; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - import org.apache.commons.io.IOUtils; -import org.hl7.fhir.convertors.R2016MayToR4Loader; -import org.hl7.fhir.convertors.R2016MayToR5Loader; -import org.hl7.fhir.convertors.R2ToR4Loader; -import org.hl7.fhir.convertors.R2ToR5Loader; -import org.hl7.fhir.convertors.R3ToR4Loader; -import org.hl7.fhir.convertors.R3ToR5Loader; -import org.hl7.fhir.convertors.R4ToR5Loader; -import org.hl7.fhir.convertors.TerminologyClientFactory; -import org.hl7.fhir.convertors.VersionConvertorAdvisor40; -import org.hl7.fhir.convertors.VersionConvertorAdvisor50; -import org.hl7.fhir.convertors.VersionConvertor_10_40; -import org.hl7.fhir.convertors.VersionConvertor_10_50; -import org.hl7.fhir.convertors.VersionConvertor_14_40; -import org.hl7.fhir.convertors.VersionConvertor_14_50; -import org.hl7.fhir.convertors.VersionConvertor_30_40; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.*; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.r5.conformance.ProfileUtilities; import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; import org.hl7.fhir.r5.elementmodel.Element; import org.hl7.fhir.r5.elementmodel.Manager; -import org.hl7.fhir.r5.elementmodel.ObjectConverter; import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.elementmodel.ObjectConverter; import org.hl7.fhir.r5.formats.FormatUtilities; -import org.hl7.fhir.r5.formats.JsonParser; -import org.hl7.fhir.r5.formats.RdfParser; -import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.formats.IParser.OutputStyle; -import org.hl7.fhir.r5.model.Base; -import org.hl7.fhir.r5.model.Bundle; -import org.hl7.fhir.r5.model.Coding; -import org.hl7.fhir.r5.model.Constants; -import org.hl7.fhir.r5.model.DomainResource; -import org.hl7.fhir.r5.model.FhirPublication; -import org.hl7.fhir.r5.model.ImplementationGuide; +import org.hl7.fhir.r5.formats.JsonParser; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent; -import org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent; -import org.hl7.fhir.r5.model.OperationOutcome; import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; -import org.hl7.fhir.r5.model.Parameters; -import org.hl7.fhir.r5.model.Reference; -import org.hl7.fhir.r5.model.Resource; -import org.hl7.fhir.r5.model.ResourceFactory; -import org.hl7.fhir.r5.model.StructureDefinition; -import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r5.model.StructureMap; import org.hl7.fhir.r5.terminologies.ConceptMapEngine; -import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel; -import org.hl7.fhir.r5.utils.IResourceValidator.CheckDisplayOption; -import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher; -import org.hl7.fhir.r5.utils.IResourceValidator.IdStatus; -import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy; -import org.hl7.fhir.r5.utils.FHIRPathEngine; -import org.hl7.fhir.r5.utils.NarrativeGenerator; -import org.hl7.fhir.r5.utils.OperationOutcomeUtilities; -import org.hl7.fhir.r5.utils.StructureMapUtilities; +import org.hl7.fhir.r5.utils.*; +import org.hl7.fhir.r5.utils.IResourceValidator.*; import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices; -import org.hl7.fhir.r5.validation.ValidationEngine.ScanOutputItem; -import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.utilities.IniFile; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; @@ -161,6 +36,64 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.Source; import org.hl7.fhir.utilities.xhtml.XhtmlComposer; import org.xml.sax.SAXException; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.util.*; +import java.util.Map.Entry; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +/* +Copyright (c) 2011+, HL7, Inc +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + /** * This is just a wrapper around the InstanceValidator class for convenient use * @@ -875,7 +808,7 @@ public class ValidationEngine implements IValidatorResourceFetcher { else throw new Exception("Unsupported format for "+fn); VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.IGR2ConvertorAdvisor5(); - r = new VersionConvertor_10_50(advisor ).convertResource(res); + r = VersionConvertor_10_50.convertResource(res, advisor); } else if (version.equals(Constants.VERSION) || "current".equals(version)) { if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) r = new XmlParser().parse(new ByteArrayInputStream(content)); @@ -1722,7 +1655,7 @@ public class ValidationEngine implements IValidatorResourceFetcher { throw new Exception("Unsupported format for "+fn); } else if (version.startsWith("1.0")) { VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.IGR2ConvertorAdvisor5(); - org.hl7.fhir.dstu2.model.Resource res = new VersionConvertor_10_50(advisor ).convertResource(r); + org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_50.convertResource(r, advisor); if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res); else if (fn.endsWith(".json") && !fn.endsWith("template.json")) diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java index 6dee8ba30..94f227698 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java @@ -7,10 +7,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.NotImplementedException; -import org.hl7.fhir.convertors.VersionConvertor_10_50; -import org.hl7.fhir.convertors.VersionConvertor_14_50; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.*; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; @@ -24,8 +21,8 @@ import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.test.utils.TestingUtilities; -import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.r5.utils.FHIRPathEngine; +import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.r5.utils.IResourceValidator; import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher; import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy; @@ -34,10 +31,8 @@ import org.hl7.fhir.r5.validation.ValidationEngine; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; -import org.hl7.fhir.utilities.json.JSONUtil; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; -import org.hl7.fhir.validation.tests.utilities.TestUtilities; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Test; @@ -45,7 +40,9 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import java.io.*; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.util.*; import java.util.Map.Entry; @@ -273,7 +270,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour else if (org.hl7.fhir.dstu2016may.model.Constants.VERSION.equals(v) || "1.4".equals(v)) return VersionConvertor_14_50.convertResource(new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(inputStream)); else if (org.hl7.fhir.dstu2.model.Constants.VERSION.equals(v) || "1.0".equals(v)) - return new VersionConvertor_10_50(null).convertResource(new org.hl7.fhir.dstu2.formats.JsonParser().parse(inputStream)); + return VersionConvertor_10_50.convertResource(new org.hl7.fhir.dstu2.formats.JsonParser().parse(inputStream)); else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(v) || "4.0".equals(v)) return VersionConvertor_40_50.convertResource(new org.hl7.fhir.r4.formats.JsonParser().parse(inputStream)); else @@ -286,7 +283,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour else if (org.hl7.fhir.dstu2016may.model.Constants.VERSION.equals(v) || "1.4".equals(v)) return VersionConvertor_14_50.convertResource(new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(inputStream)); else if (org.hl7.fhir.dstu2.model.Constants.VERSION.equals(v) || "1.0".equals(v)) - return new VersionConvertor_10_50(null).convertResource(new org.hl7.fhir.dstu2.formats.XmlParser().parse(inputStream)); + return VersionConvertor_10_50.convertResource(new org.hl7.fhir.dstu2.formats.XmlParser().parse(inputStream)); else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(v) || "4.0".equals(v)) return VersionConvertor_40_50.convertResource(new org.hl7.fhir.r4.formats.XmlParser().parse(inputStream)); else diff --git a/pom.xml b/pom.xml index 0f01ac8e9..5136ed66c 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,22 @@ test + + + + com.github.javaparser + javaparser-symbol-solver-core + 3.15.9 + + + + + org.junit.jupiter + junit-jupiter + RELEASE + test + + @@ -113,6 +129,8 @@ txtmark 0.13 + +